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

  1. Create an MR that only changes the .tool-versions file
  2. 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:

  1. Include the cache:assets-hash job when .tool-versions changes in non-expedited pipelines, or
  2. Make the dependency optional using needs:optional in the build-gdk-image job 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