Add feature toggle for security policy custom CI YAML
What does this MR do and why?
This adds a feature toggle for the policy custom CI YAML feature as a group level setting using the cascading settings framework.
We are planning to release the feature as an experiment.
The toggle itself is behind the compliance_pipeline_in_policies
feature flag. The plan is to:
- Add the feature toggle behind the feature flag. (this MR)
- Default enable the feature flag.
- The feature will still be disabled by default, but users now may choose to opt-in by enabling the toggle.
I tried to keep the frontend changes in this MR minimal. Before we can enable the feature flag and release the toggle, we need to:
- Tweak the UI to look like "Experiment" UI chip like proposed here.
- Control the UI with the feature toggle instead of only the feature flag.
Screenshots or screen recordings
How to set up and validate locally
- Enable the feature flag
echo "Feature.enable(:compliance_pipeline_in_policies)" | rails c
- Create a new group
- Go to the group settings page.
- Expand the Permissions and group features section
- Enable Run customized CI YAML file as security policy actions
- Create a new project in the group
- Add a simple
.gitlab-ci.yml
file:job1: stage: build script: - echo "Hello"
- Go back to the group and select Secure -> Policies
- Select New policy -> Scan execution policy
- Switch to .yaml mode and paste the following policy
type: scan_execution_policy name: 'test' description: '' enabled: true policy_scope: compliance_frameworks: [] rules: - type: pipeline branch_type: all actions: - scan: secret_detection - scan: custom ci_configuration: |- job2: stage: build script: - echo "Hello"
- Go back to your project and start a pipeline
- The pipeline should contain job1 and job2
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #433236 (closed)
Edited by Andy Schoenen