Follow-up: Introduce Parameters to bulk delete API endpoint
Note: Follow up to issue #223793
Problem to Solve
As indicated in the initial MR for artifact expiration:
As a developer, I like this implementation [referring to the
.gitlab-ci.yml], because it keeps all of the configuration in the project YAML files. As a GitLab administrator, I worry about having to track down projects that haven't yet added the expiration directives to their YAML files, as well as cleaning up old artifacts that are never going to expire). It would be nice if there were some admin tools for cleaning up build artifacts (like "expire all artifacts > 30 days old that are not git tags").
The problem to solve here is that administrators need a way to efficiently clean up old, non-essential artifacts.
Issue #16267 (closed), allows for keeping the latest artifacts for important jobs, which can be used with an overall aggressive
expire_in policy to ensure that you always have the latest important artifacts, but all others are quickly discarded. That's insufficient, though, because some projects may not be setting an aggressive
In issue #223793 - we introduce a bulk delete endpoint for artifacts per project.
The scope of work here is to add parameters that allow for doing more general cleanups efficiently:
delete_tags: delete artifacts also for tags,
keep_n: keep N last artifacts for succesful pipelines on each branch,
delete_orphaned: delete all orphaned branch and tags (no longer present in git repo),
older_than: delete older than
In the future, you could imagine a cleanup button in the project settings page, accessible only to Maintainers, that allows for the same operation as the API endpoint.
In the meantime, I've released a tool called
gitlab-artifact-cleanup which accomplishes this via the API: https://gitlab.com/JonathonReinhart/gitlab-artifact-cleanup