Intermediate artifacts can be expired when they're still required
When using artifacts to pass data between stages, it is possible for artifacts to expire before the pipeline completes, leaving dependent jobs without the goods.
build:
stage: build
artifacts:
paths:
- ./build
expire_in: 1 hrs
script:
- ./build.sh # populate ./build
test:
stage: test
dependencies:
- build
script:
- run tests against ./build
In this example, the artifacts frombuild
are only useful to test
, and we do not wish to keep them around any longer than necessary. If test
takes a sufficiently long time to begin after after build
completes, or if test
is retried later, those artifacts will have expired.
Some possibilities:
-
artifacts:expire_in =
on_pipeline_success
: As mentioned here and here,artifacts:expire_in
could support "when pipeline completes successfully". -
Utilize dependencies: job:dependencies already tracks the artifact dependencies between jobs. It could be used to ensure that artifacts are not expired before they are needed.