WIP: Solve stuck pipeline when depending with dag on a manual job
What does this MR do?
Related to: #31264 (closed)
This MR aims to solve the problem that pipelines get stuck when a job needs a manual job.
The idea behind this MR is to make a manual job "blocker" if another job needs it, even the manual job is allow_failure:true
.
Example 1
test:
stage: test
when: manual
allow_failure: true
script: exit 1
deploy:
stage: deploy
script: exit 0
needs: [test]
# Current behavior:
# test: manual / stage: skipped
# deploy: created / stage: created
# pipeline: created
# Fixed behavior:
# test: manual / stage: manual
# deploy: created / stage: created
# pipeline: manual
Example 2
build:
stage: build
script: exit 0
test:
stage: test
when: manual
allow_failure: true
script: exit 1
deploy:
stage: deploy
script: exit 0
needs: [test]
# Current behavior:
# build: success / stage: success
# test: manual / stage: skipped
# deploy: created / stage: created
# pipeline: running
# Fixed behavior:
# build: success / stage: success
# test: manual / stage: manual
# deploy: created / stage: created
# pipeline: manual
Screenshots
SQL Query Changes
From:
SELECT "ci_builds"."id",
"ci_builds"."name",
"ci_builds"."status",
"ci_builds"."allow_failure",
"ci_builds"."stage_idx",
"ci_builds"."processed",
"ci_builds"."lock_version"
FROM "ci_builds"
WHERE "ci_builds"."commit_id" = 150901085
AND ("ci_builds"."retried" = FALSE
OR "ci_builds"."retried" IS NULL)
ORDER BY "ci_builds"."stage_idx" ASC;
https://explain.depesz.com/s/NoOs
To:
SELECT "ci_builds"."id",
"ci_builds"."name",
"ci_builds"."status",
"ci_builds"."allow_failure",
"ci_builds"."stage_idx",
"ci_builds"."processed",
"ci_builds"."lock_version",
(SELECT TRUE
FROM "ci_build_needs"
WHERE (ci_builds.name = ci_build_needs.name) LIMIT 1) AS has_dag_dependent
FROM "ci_builds"
WHERE "ci_builds"."commit_id" = 150901085
AND ("ci_builds"."retried" = FALSE
OR "ci_builds"."retried" IS NULL)
ORDER BY "ci_builds"."stage_idx" ASC;
https://explain.depesz.com/s/SVce
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
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 Thao Yeager