[go: up one dir, main page]

Skip to content

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

Screenshots or screen recordings

Before After
CleanShot_2025-07-21_at_19.10.36_2x CleanShot_2025-07-21_at_19.10.45_2x

How to set up and validate locally

  1. Create a project
  2. In the project, create PEP without declaring stages:
    policy-build-job:
      stage: build
      script: exit 0
    
    policy-test-job:
      stage: test
      script: exit 0
  3. Create .gitlab-ci.yml in 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
  4. 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

Merge request reports

Loading