Skip to content

Pipeline Execution Action with external CI fails with "Undefined error"

Summary

Creating pipelines for projects with a pipeline Execution policy fails with "Undefined error" if the policy uses an external CI file.

Screenshot_2024-01-08_at_13.30.31

Steps to reproduce

  1. Create a new Group.
  2. Navigate to Settings -> General.
  3. Expand the Permissions and group features section.
  4. Enable the "Run customized CI YAML file as security policy actions" experiment.
  5. Create a new project in the group.
  6. Add a new file called 'ci.yml' to the project with content:
    Security Policy CI Job:
      stage: test
      script:
        - echo "This defined in a scan execution policy"
  7. Create another project in the group with a simple ci file:
    Job From Project CI:
      stage: test
      script:
        - echo "Ci job"
  8. Select Secure -> Policies -> New policy .
  9. Select Scan execution policy.
  10. Choose a name.
  11. Select Add new action.
  12. Select Run CI/CD code.
  13. Select Run linked existing CI file.
  14. Select the ci.yml file from the first project you created.
  15. Select Configure with a merge request and merge the MR.
  16. Go back to the previous project and start a new pipeline.
  17. This should fail with "Undefined error".

Example Project

https://gitlab.com/gitlab-org/govern/security-policies/andys-test-group/custom-ci-yaml-demo/test

Possible fixes

When fetching CI variables, we only take the ci_configuration option into account (ee/app/services/security/security_orchestration_policies/scan_pipeline_service.rb:55). With an external CI file, the action uses the ci_configuration_path option instead. In this case, we need to load the external file and fetch variables from there.

Edited by Andy Schoenen