Pipeline doesn't succeed when manual jobs using new DAG dependency "needs:" are waiting for other "when: manual" jobs to succeed
Summary
Pipeline doesn't succeed when jobs with "when:manual" and using new DAG dependency "needs:" are waiting for other "when: manual" jobs to succeed
Additional explanation
- When a non-manual stage job is in the next stage of a manual job with
allow_failure: true
(which is a default setting of a manual job), the manual job is skipped and the normal job runs. - When a non-manual stage job is in the next stage of a manual job with explicit
allow_failure: false
, the manual job blocks the next stage. - When a DAG job needs a manual job, the manual job blocks the DAG job to run.
- However, the pipeline's status stays at
created
orrunning
, because the manual job is actually skipped and not a blocker for regular jobs and the pipeline.
- However, the pipeline's status stays at
- When a DAG job needs a manual job with
allow_failure: false
, the manual job blocks the DAG job to run.
This bug describes the problem of scenario number 3
Proposal
Mark both the manual job and the DAG job that needs the manual job as skipped jobs, in case users would like to block the pipeline they can add allow_failure: false to the manual job
Screenshots (strongly suggested)
Example 1
Config:
test:
stage: test
when: manual
script: exit 0
deploy:
stage: deploy
script: exit 0
needs: [test]
After this MR:
Example 2
Config:
build:
stage: build
script: exit 0
test:
stage: test
when: manual
script: exit 0
deploy:
stage: deploy
script: exit 0
needs: [build, test]
Before this MR:
After this MR:
Example 3
Steps to reproduce
- Create 3 stages
- Add a regular job on the 1st stage
- Add manual jobs (with the "when: manual" keyword on .gitlab-ci.yaml) on the 2nd stage (with or without regular jobs)
- On the 3rd stage create either 1) an automatic job that has "allow_failure: true" and/or 2) a manual job
- Add a "needs: " tag on the jobs of the 3rd stage and make them depend on at least one manual job on the 2nd stage
- Run the flow and it will stay "running" forever while manual jobs aren't canceled.
What is the current bug behavior?
Pipeline stays in the "running" sate forever since all next stage's manual jobs that have dependencies are waiting for the previous stage's manual jobs to end, even if they are all allowed to fail.
This also affects the "Merge" button when merges are only allowed if a pipeline succeeds, since it stays disabled if a pipeline does not succeed. The screenshots below depict a scenario where we expect that the pipeline success does not depend on QA jobs to finish, while taking advantage of the new DAG feature.
What is the expected correct behavior?
One should expect to see the pipeline marked as "Passed", either green or orange, when the pipeline is left with only manual jobs or automatic jobs that allows failure.
As a note, if one setups a set of manual jobs to run on a stage without having jobs depending on them with the "needs:" keyword, the pipeline ignores them to set the pipeline's success or not (this considering the default behavior of allowing them to fail).
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com
This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.