Job-level needs take precedence over rules: needs
Summary
CI/CD YAML syntax reference states:
needsin rules override anyneedsdefined at the job-level. When overridden, the behavior is same as job-levelneeds.
This is the opposite of the the truth.
Steps to reproduce
- Create a project
- Put the following below in the
.gitlab-ci.yml
---
job_zero:
rules:
- if: $CI
when: never
script:
- echo "say what now"
job_one:
rules:
- if: $CI
needs: []
needs:
- job_zero
script:
- echo "success"
Example Project
https://gitlab.com/repsak/debug-rules-needs
What is the current bug behavior?
An error is shown:
Unable to create pipeline
- 'job_one' job needs 'job_zero' job, but 'job_zero' is not in any previous stage
What is the expected correct behavior?
The rules level needs takes precedence, and job_one runs without depending on job_zero.
Output of checks
This bug happens on GitLab.com
Edited by Kasper