- Include details about your goal:
I wish to set one artifacts expire_in for all artifacts of the pipeline in gitlab, just once, without having to set it per job (multiple times).
- Describe what I have tried:
In my gitlab ci yml file, I have this at the top of the file:
default:
artifacts:
expire_in: 2 mins 42 secs
- Describe expected results:
I was expecting with this setup, all artifacts produced from the pipeline would take into account the expiry time.
- Describe actual results:
Unfortunately, it seems none of the jobs are picking up on the expiry time. Meaning, the artifacts stay for weeks.
- Question:
How to tell gitlab to set one common expiry time for all the artifacts of the pipeline, without having to do that (I have many many jobs)
jobone:
image: someimage
stage: somestage
script:
- echo running some script which will produce some artifact
artifacts:
paths: [ path/to/myartifact ]
expire_in: 2 mins 42 secs
jobtwo:
image: someimage
stage: somestage
script:
- echo running some script which will produce some other artifact
artifacts:
paths: [ path/to/myartifact ]
expire_in: 2 mins 42 secs
[...]
jobseventy:
image: someimage
stage: somestage
script:
- echo running some script which will produce some other other artifact
artifacts:
paths: [ path/to/myartifact ]
expire_in: 2 mins 42 secs
With the approach of setting the expiry time per job, it works, but I have some seventy steps in my pipeline, so duplicating the expiry time N times.
Is there a way to set it up just once, and have all steps that produce artifacts to pick on the time?