Introduce additional parameters to bulk delete API endpoint
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Collaborate/take over this issue](https://contributors.gitlab.com/manage-issue?action=work&projectId=278964&issueIid=14495) </details> <!--IssueSummary end--> Note: Follow up to issue https://gitlab.com/gitlab-org/gitlab/-/issues/223793 ### Problem to Solve As [indicated](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4200#note_12172954) in the initial MR for artifact expiration: > As a developer, I like this implementation _\[referring to the `expire_in` tag in `.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. ## Implementation Guide Issue https://gitlab.com/gitlab-org/gitlab/issues/16267, 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 `expire_in` policy. In issue https://gitlab.com/gitlab-org/gitlab/-/issues/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 (In order of priority): * `older_than`: delete older than * `delete_orphaned`: delete all orphaned branch and tags (no longer present in git repo), The following two are TBD based on popularity. * `delete_tags`: delete artifacts also for tags, * `keep_n`: keep N last artifacts for succesful pipelines on each branch, We can extend the current endpoint with the associated parameters ### Future Improvements 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. ### Workaround **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** <!--triage-serverless v3 PLEASE DO NOT REMOVE THIS SECTION--> _This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc._ <!--triage-serverless v3 PLEASE DO NOT REMOVE THIS SECTION--> <!-- triage-serverless v3 PLEASE DO NOT REMOVE THIS SECTION --> *This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.* <!-- triage-serverless v3 PLEASE DO NOT REMOVE THIS SECTION -->
issue