Make "keep latest artifact" a project-level configuration
Keeping the latest artifact from the most recent successful job is a useful default behavior but can also result in significant amounts of storage usage. This can cause an unexpected surge in disk space usage if you have pipelines that generate large artifacts. To improve storage consumption management, you can now disable this behavior for any project in the settings.
Coming up next, gitlab#276583 will allow you to entirely disable keeping the latest artifacts at the instance level.
Problem to solve
Currently the latest artifacts from a successful job/pipeline is always kept (implemented in #16267 (closed)) which is causing unwanted consumption of storage because there is no way to disable this at a project level or disable this for tags.
This issue addresses comment #16267 (comment 401284828).
User experience goal
Provide users with an option to opt out of keeping the artifacts from last job, at project level.
The settings for storing the latest artifacts from the last job would be enabled by defaults. If needed, users could opt out of this by unchecking the
Keep latest artifacts from last successful jobs option under the Artifacts section on the projectlevel settings page.
When viewing an artifact for a project where
Keep latest artifacts from last successful jobs option is unchecked/disabled, update the copy in the sidebar to communicate that these latest artifacts will be deleted unless option to keep latest artifact regardless of expiration is enabled in project Settings > CI/CD > Artifacts.`
Permissions and Security
Availability & Testing
- Unit test changes - Yes, please add unit tests for new implemented logic accordingly.
- End-to-end test change - There are 2 scenarios to be covered in E2E test, when this option is selected (by default) and when it is not. IMHO, The first scenario is already covered in this test locked_artifacts_spec.rb. The second scenario will need to be worked on while implementing this feature. Here is the proposal gitlab-org/quality/testcases#1104