Set short expiration time (1 month ?) for artifacts except for pipelines running on master (6 months)
Affected parts of the CI pipeline:
- Build
- Check
- Validate
Idea 1: Conditional artifacts
For the moment, it is not possible to put rules/conditions inside the artifacts
section (see more https://gitlab.com/gitlab-org/gitlab-foss/-/issues/30936).
The possible solution is to store the main job part in a hook/base job and change the artifacts section accordingly (expire_in: 6 months
on the master branch and expire_in: 1 month
for the rest).
However, by doing this we end up with a duplication of an X
job (X-short-artifacts
and X-long-artifacts
) which then are used in subsequent stages (build jobs' artifacts are reused by check jobs). So, now we not only need to duplicate the check jobs by the type of input artifacts (short/long), but also by their output artifacts (short/long) which are created by the check jobs.
Idea 2: Conditional variables
Since recently, conditional variables are possible. However, expire_in
keyword can only take a specified value (duration) and not a variable.
Idea 3: Uniform expiration time, no matter the branch
Use everywhere the maximal required expiration time. I propose to use:
- Build: 1 month, these builds are fast and also not very useful
- Check: 6 months, running a test takes time and the result might be useful for future comparisons!
- Validate: 6 months, as long as the check outputs are available. Validation data is really small, so it is not a problem!