'How to delete GitLab-CI Jobs after 30 days
We are using gitlab-ci as CI tool. We have several projects and several builds are running all the time.
I couldn't find a way for deleting build of gitlab-ci after few days. How can we delete gitlab-ci jobs after 30 days?
Solution 1:[1]
Add an expire_in value to your artifacts section of your .gitlab-ci.yml file. See Documentation.
This will delete the artifacts of your jobs after a certain time.
Sample:
artifacts:
name: "${CI_PROJECT_NAMESPACE}_${CI_PROJECT_NAME}"
paths:
- build/libs/*.jar
expire_in: 30 days
As far as I know there is no way to automatically delete the jobs, like it can be done with artifacts.
The only way to delete jobs is to use the GUI or by API /projects/:id/jobs/:job_id/erase (Documentation).
Solution 2:[2]
it will be possible after completion of feature issue
https://gitlab.com/gitlab-org/gitlab/-/issues/338480
so, please track it and upvote if you like
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Vladimir.Shramov |
