Managing Artifacts in GitLab CI/CD: Data Sharing Between Jobs
55%
Expiring Artifacts
By default, the expiration date is set to 30 days. This setting is global and can be changed in the GitLab settings. However, you can also set an expiration date for each artifact. If you want to do this, you should use the expire_in keyword. This is how it is done:
...
...
test:
stage: test
script:
- ...
artifacts:
paths:
- flake8.txt
expire_in: 1 week
...
...
ℹ️ Sometimes the expiration date is too short, this may impact later jobs that fetch the artifacts. Consider setting an appropriate expiration date otherwise your pipeline may fail.
In the above example, the flake8.txt artifact will expire in one week. To protect the artifact from being deleted, you can use never as the expiration date:
...
...
test:
stage: test
script:
- ...
artifacts:
paths:
- flake8.txt
expire_in: never
...
...
Cloud Native CI/CD with GitLab
From Commit to Production ReadyEnroll now to unlock all content and receive all future updates for free.
