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.
Steps to reproduce
- Create a new Group.
- Navigate to Settings -> General.
- Expand the Permissions and group features section.
- Enable the "Run customized CI YAML file as security policy actions" experiment.
- Create a new project in the group.
- 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"
- Create another project in the group with a simple ci file:
Job From Project CI: stage: test script: - echo "Ci job"
- Select Secure -> Policies -> New policy .
- Select Scan execution policy.
- Choose a name.
- Select Add new action.
- Select Run CI/CD code.
- Select Run linked existing CI file.
- Select the
ci.yml
file from the first project you created. - Select Configure with a merge request and merge the MR.
- Go back to the previous project and start a new pipeline.
- 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