dependency-scanning-with-reachability job: need build is not defined in current or prior stages

Summary

The introduction of static reachability in the Dependency-Scanning.latest.gitlab-ci.yaml CI template is causing an error at pipeline creation in the following situation:

  • a job named build is defined in a stage executed after the test stage where the Dependency Scanning job are running.

We made the assumption that the build job would always run before and did not account for this when introducing the needs: build.

We are looking at a fix and in the meantime you can work around the problem by overridding the job definition to change the remove the needs: build.

Workaround

We are looking at a fix and in the meantime you can work around the problem by overridding the definition of the dependency-scanning-with-reachability job as follow:

dependency-scanning-with-reachability:
  needs:
    - job: gitlab-static-reachability
      optional: true
      artifacts: true

Steps to reproduce

Example Project

What is the current bug behavior?

Screenshot_2025-04-11_at_11.20.57

What is the expected correct behavior?

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Edited by Olivier Gonzalez