Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Artifact deletion in actions ui #27172

Merged
merged 21 commits into from
Feb 18, 2024
Merged

Conversation

fuxiaohei
Copy link
Contributor

@fuxiaohei fuxiaohei commented Sep 21, 2023

Add deletion link in runs view page.
Fix #26315

image

When click deletion button. It marks this artifact need-delete.

This artifact would be deleted when actions cleanup cron task.

@GiteaBot
Copy link
Contributor

@fuxiaohei I noticed you've updated the locales for non-English languages. These will be overwritten during the sync from our translation tool Crowdin. If you'd like to contribute your translations, please visit https://crowdin.com/project/gitea. Please revert the changes done on these files. 🍵

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Sep 21, 2023
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 21, 2023
@github-actions github-actions bot added the topic/ui Change the appearance of the Gitea UI label Sep 21, 2023
@lunny lunny added this to the 1.22.0 milestone Sep 21, 2023
@lunny lunny added type/enhancement An improvement of existing functionality topic/gitea-actions related to the actions of Gitea labels Sep 21, 2023
@pull-request-size pull-request-size bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 22, 2023
services/actions/cleanup.go Outdated Show resolved Hide resolved
@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 17, 2023
@silverwind
Copy link
Member

Overall LGTM after above translation change.

@fuxiaohei fuxiaohei requested a review from delvh January 17, 2024 14:44
models/actions/artifact.go Outdated Show resolved Hide resolved
@silverwind
Copy link
Member

Still waiting on @delvh?

web_src/js/components/RepoActionView.vue Outdated Show resolved Hide resolved
routers/web/repo/actions/view.go Outdated Show resolved Hide resolved
services/actions/cleanup.go Outdated Show resolved Hide resolved
@fuxiaohei
Copy link
Contributor Author

@delvh continue to review?

@delvh delvh added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Feb 18, 2024
@lunny lunny enabled auto-merge (squash) February 18, 2024 10:02
@lunny lunny merged commit 67adc5c into go-gitea:main Feb 18, 2024
26 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Feb 18, 2024
Comment on lines +62 to +65
if err := storage.ActionsArtifacts.Delete(artifact.StoragePath); err != nil {
log.Error("Cannot delete artifact %d: %v", artifact.ID, err)
continue
}
Copy link
Contributor

@wxiaoguang wxiaoguang Feb 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the file doesn't exist in the storage (eg: site admin deleted them manually), this function won't function anymore (always "continue", and then will be a deadloop if there are a lot pending but non-existing items)

zjjhot added a commit to zjjhot/gitea that referenced this pull request Feb 18, 2024
* giteaofficial/main: (28 commits)
  Improve TrHTML and add more tests (go-gitea#29228)
  Convert visibility to number (go-gitea#29226)
  Implement some action notifier functions (go-gitea#29173)
  Artifact deletion in actions ui (go-gitea#27172)
  Update docs for actions variables (go-gitea#29239)
  Refactor more code in templates  (go-gitea#29236)
  Use "Safe" modifier for manually constructed safe HTML strings in templates (go-gitea#29227)
  Remove jQuery from the repo release form (go-gitea#29225)
  Make submit event code work with both jQuery event and native event (go-gitea#29223)
  Remove jQuery from repo migrate page (go-gitea#29219)
  Remove unneccesary `initUserAuthLinkAccountView` from "link account" page (go-gitea#29217)
  Fix labels referencing the wrong ID in the user profile settings (go-gitea#29199)
  Fix label `for` pointing to a `name` instead of `id` in webhook settings (go-gitea#29209)
  Load outdated comments when (un)resolving conversation on PR timeline (go-gitea#29203)
  Fix missing template for follow button in organization (go-gitea#29215)
  Enable markdownlint `no-trailing-punctuation` and `no-blanks-blockquote` (go-gitea#29214)
  Remove jQuery from the webhook editor (go-gitea#29211)
  Remove jQuery from issue reference context popup attach (go-gitea#29216)
  fix typo (go-gitea#29212)
  Fix debian InRelease Acquire-By-Hash newline (go-gitea#29204)
  ...
lunny pushed a commit that referenced this pull request Feb 18, 2024
#27172 (comment)

When cleanup artifacts, it removes storage first. If storage is not
exist (maybe delete manually), it gets error and continue loop. It makes
a dead loop if there are a lot pending but non-existing artifacts.

Now it updates db record at first to avoid keep a lot of pending status
artifacts.
silverwind pushed a commit to silverwind/gitea that referenced this pull request Feb 20, 2024
Add deletion link in runs view page.
Fix go-gitea#26315


![image](https://github.com/go-gitea/gitea/assets/2142787/aa65a4ab-f434-4deb-b953-21e63c212033)

When click deletion button. It marks this artifact `need-delete`.

This artifact would be deleted when actions cleanup cron task.
silverwind pushed a commit to silverwind/gitea that referenced this pull request Feb 20, 2024
go-gitea#27172 (comment)

When cleanup artifacts, it removes storage first. If storage is not
exist (maybe delete manually), it gets error and continue loop. It makes
a dead loop if there are a lot pending but non-existing artifacts.

Now it updates db record at first to avoid keep a lot of pending status
artifacts.
DennisRasey pushed a commit to DennisRasey/forgejo that referenced this pull request Feb 23, 2024
go-gitea/gitea#27172 (comment)

When cleanup artifacts, it removes storage first. If storage is not
exist (maybe delete manually), it gets error and continue loop. It makes
a dead loop if there are a lot pending but non-existing artifacts.

Now it updates db record at first to avoid keep a lot of pending status
artifacts.
6543 pushed a commit to 6543-forks/gitea that referenced this pull request Feb 26, 2024
Add deletion link in runs view page.
Fix go-gitea#26315

![image](https://github.com/go-gitea/gitea/assets/2142787/aa65a4ab-f434-4deb-b953-21e63c212033)

When click deletion button. It marks this artifact `need-delete`.

This artifact would be deleted when actions cleanup cron task.
Copy link

Automatically locked because of our CONTRIBUTING guidelines

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 28, 2024
@@ -1368,6 +1368,7 @@ func registerRoutes(m *web.Route) {
m.Post("/approve", reqRepoActionsWriter, actions.Approve)
m.Post("/artifacts", actions.ArtifactsView)
m.Get("/artifacts/{artifact_name}", actions.ArtifactsDownloadView)
m.Delete("/artifacts/{artifact_name}", actions.ArtifactsDeleteView)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it require reqRepoActionsWriter permission?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The check is in the function ArtifactsDeleteView internal code but not here. It's better to move it out of that function.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/translation size/L Denotes a PR that changes 100-499 lines, ignoring generated files. topic/gitea-actions related to the actions of Gitea topic/ui Change the appearance of the Gitea UI type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow deleting artefacts from the UI
6 participants