Fix PEP cyclic dependencies error with non-standard project stages order
What does this MR do and why?
Fix PEP cyclic dependencies error with non-standard project stages order.
When project pipeline uses the default stages in a non-standard order, inject_policy pipeline execution policy has to specify the stages in the same relative order, otherwise pipelines fail to start with cyclic dependencies detected error.
This change fixes it by not collecting the policy stages unless the stages are explicitly declared.
Depends on refactoring from !194147 (merged).
References
- #545147 (comment 2635285810)
- Slack (internal)
- https://gitlab.com/gitlab-com/account-management/eastern-north-america/lululemon-athletica/lululemon-athletica/-/issues/206
Screenshots or screen recordings
| Before | After |
|---|---|
![]() |
![]() |
How to set up and validate locally
- Create a project
- In the project, create PEP without declaring stages:
policy-build-job: stage: build script: exit 0 policy-test-job: stage: test script: exit 0 - Create
.gitlab-ci.ymlin the project which uses non-standard order of stages:stages: [test, build, deploy] project-build: stage: build script: exit 0 project-test: stage: test script: exit 0 project-deploy: stage: deploy script: exit 0 - Run the pipeline and verify it can be created
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #556754 (closed)
Edited by Martin Čavoj

