Skip to content

Draft: [strategy: block] Fix pipeline status when DAG jobs needs manual jobs

Furkan Ayhan requested to merge 31264-blocked into master

What does this MR do?

This is just a simple/ugly approach for the ~bug in #31264 (closed). I know this is not a perfect implementation and can't be a long-term solution, but it can fix the 1-year-old issue with 116 upvotes.

  1. When a normal stage job is in the next stage of a manual job with allow_failure: true, the manual job is skipped and the normal job runs.
    • Everything is okay
  2. When a normal stage job is in the next stage of a manual job with allow_failure: false, the manual job blocks the next stage.
    • Everything is okay
  3. When a DAG job needs a manual job with allow_failure: true, the manual job blocks the DAG job to run.
    • However, the pipeline's status stays at created or running, because the manual job is actually skipped and not a blocker for regular jobs and the pipeline.
  4. When a DAG job needs a manual job with allow_failure: false, the manual job blocks the DAG job to run.
    • Everything is okay

This MR fixes the problem in the 3rd point. Please see the Screenshots below.

p.s. This will probably need a feature flag if the proposal is accepted.

Screenshots (strongly suggested)

Example 1

Config:

test:
  stage: test
  when: manual
  script: exit 0

deploy:
  stage: deploy
  script: exit 0
  needs: [test]

Before this MR: Screen_Shot_2020-11-18_at_23.05.49

Screen_Shot_2020-11-18_at_23.05.56

After this MR:

Screen_Shot_2020-11-18_at_22.52.35

Screen_Shot_2020-11-18_at_22.52.46

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:

Screen_Shot_2020-11-18_at_23.06.20

Screen_Shot_2020-11-18_at_23.06.27

After this MR:

Screen_Shot_2020-11-18_at_22.54.02

Screen_Shot_2020-11-18_at_22.54.14

Example 3

Config:

stages: [build, test, review, deploy]

build:
  stage: build
  script: exit 0

test:
  stage: test
  script: exit 0

release_test:
  stage: test
  when: manual
  script: exit 0

review:
  stage: review
  script: exit 0
  needs: [test, release_test]

staging:
  stage: deploy
  script: exit 0
  needs: [test, release_test]

production:
  stage: deploy
  script: exit 0
  needs: [review]

Before this MR:

Screen_Shot_2020-11-18_at_23.05.08

Screen_Shot_2020-11-18_at_23.05.00

After this MR:

Screen_Shot_2020-11-18_at_22.51.43

Screen_Shot_2020-11-18_at_22.51.36

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Furkan Ayhan

Merge request reports