MR pipelines fail when only .tool-versions file is changed due to missing cache:assets-hash job
Summary
MR pipelines fail when the .tool-versions file is changed because the build-gdk-image job requires the cache:assets-hash job, but cache:assets-hash does not exist in non-expedited pipelines due to pipeline rules.
Steps to reproduce
- Create an MR that only changes the
.tool-versionsfile - Observe that the pipeline fails with a job dependency error
Example
MR: !214053 (merged) Pipeline: https://gitlab.com/gitlab-org/gitlab/-/pipelines/2178360688
Error message
'build-gdk-image' job needs 'cache:assets-hash' job, but 'cache:assets-hash' does not exist in the pipeline. This might be because of the only, except, or rules keywords. To need a job that sometimes does not exist in the pipeline, use needs:optional.
Expected behavior
The pipeline should either:
- Include the
cache:assets-hashjob when.tool-versionschanges in non-expedited pipelines, or - Make the dependency optional using
needs:optionalin thebuild-gdk-imagejob configuration
Actual behavior
The pipeline fails because build-gdk-image has a hard dependency on cache:assets-hash, but the latter is excluded from non-expedited pipelines based on the changed files.
Workaround
Adding the pipeline::expedited label resolves the issue by including the necessary jobs in the pipeline.
Edited by Kev Kloss