diff options
author | FuXiaoHei <fuxiaohei@vip.qq.com> | 2023-09-06 15:41:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-06 07:41:06 +0000 |
commit | 460a2b0edffe71d9e64633beaa1071fcf4a33369 (patch) | |
tree | 361d9adbf0db9bd12f72ac0034fdcdd2dcf65cfc /modules/setting | |
parent | 113eb5fc24f0890950167ca0dcc914bf858861ff (diff) | |
download | gitea-460a2b0edffe71d9e64633beaa1071fcf4a33369.tar.gz gitea-460a2b0edffe71d9e64633beaa1071fcf4a33369.zip |
Artifacts retention and auto clean up (#26131)
Currently, Artifact does not have an expiration and automatic cleanup
mechanism, and this feature needs to be added. It contains the following
key points:
- [x] add global artifact retention days option in config file. Default
value is 90 days.
- [x] add cron task to clean up expired artifacts. It should run once a
day.
- [x] support custom retention period from `retention-days: 5` in
`upload-artifact@v3`.
- [x] artifacts link in actions view should be non-clickable text when
expired.
Diffstat (limited to 'modules/setting')
-rw-r--r-- | modules/setting/actions.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/modules/setting/actions.go b/modules/setting/actions.go index a13330dcd1..bfc502c0cb 100644 --- a/modules/setting/actions.go +++ b/modules/setting/actions.go @@ -13,10 +13,11 @@ import ( // Actions settings var ( Actions = struct { - LogStorage *Storage // how the created logs should be stored - ArtifactStorage *Storage // how the created artifacts should be stored - Enabled bool - DefaultActionsURL defaultActionsURL `ini:"DEFAULT_ACTIONS_URL"` + LogStorage *Storage // how the created logs should be stored + ArtifactStorage *Storage // how the created artifacts should be stored + ArtifactRetentionDays int64 `ini:"ARTIFACT_RETENTION_DAYS"` + Enabled bool + DefaultActionsURL defaultActionsURL `ini:"DEFAULT_ACTIONS_URL"` }{ Enabled: false, DefaultActionsURL: defaultActionsURLGitHub, @@ -76,5 +77,10 @@ func loadActionsFrom(rootCfg ConfigProvider) error { Actions.ArtifactStorage, err = getStorage(rootCfg, "actions_artifacts", "", actionsSec) + // default to 90 days in Github Actions + if Actions.ArtifactRetentionDays <= 0 { + Actions.ArtifactRetentionDays = 90 + } + return err } |