CI: needs can refer to a stage as well as a job
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Problem to solve
First of all thanks for implementing needs, it's been super useful to us!
Our pipeline includes stages build, test and deploy (it's more complicated than that, but not relevant here). We want both test and deploy to run only if all the build jobs succeed. But we don't want deploy to wait for test.
If build contains more than 5 jobs, we have to leave some out in order to implement this with needs. Even if there are <= 5 jobs, it seems tedious and error-prone to have to list the jobs (what if a new job is added? what if one gets renamed? etc)
Intended users
Personas are described at https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/ -->
Proposal
Allow an extended needs syntax as follows:
needs: ['job-name-1', 'job-name-2'] # works as present
needs: # equivalent to above
jobs: ['job-name-1', 'job-name-2']
needs: # waits for all jobs in the given stages (except jobs that are not present in the pipeline)
stages: ['stage-name-1', 'stage-name-2']
needs: # (stretch goal) combination of the above, waits for jobs AND stages
jobs: ['job-name-1', 'job-name-2']
stages: ['stage-name-1', 'stage-name-2']
Permissions and Security
N/A
Documentation
YAML reference will need updating.
Testing
Extension of any existing tests for the needs keyword. Listing a stage name should be equivalent to listing all jobs for that stage, however if a job is not present in the pipeline (e.g. due to an except clause), we should not wait for it.
What does success look like, and how can we measure that?
Just passing all tests?
What is the type of buyer?
Free tier ideally.