Skip to content

Support Pipeline execution policies in policy commit

What does this MR do and why?

This MR adds support for Pipeline execution policies when committing changes to the policy.

It also extends the schema and adds pipeline_config_strategy as a required property (which we can freely do because the feature is behind a feature flag).

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  1. In rails console enable the feature flag
    Feature.enable(:pipeline_execution_policy_type)
  2. Visit a group.
  3. Go to Settings -> General
  4. Under Permissions and group features, enable Security policy pipeline execution action
  5. Create a project in this group
  6. Go to Secure -> Policies and create a new Pipeline execution policy
  7. Go to .yaml mode and use the following yaml. Change project to another existing project and file to any file within that project.
    type: pipeline_execution_policy
    name: Test
    description: ''
    enabled: true
    pipeline_config_strategy: inject_ci
    content:
      include:
        project: gitlab-org/pipeline-execution-policies/compliance-project
        file: compliance.yml
  8. Configure via merge request and merge
  9. Go back to the project's policies, the policy should show up
  10. Edit the policy, it should load policy in the editor (with rule mode disabled until !155481 (merged) is merged)

Related to #465867 (closed)

Edited by Martin Čavoj

Merge request reports