Scan execution policy: allow selection of branch type
Why are we doing this work
This issue resolves frontend part for scan execution policy
.
We need to provide user ability to select branch_type both for rule mode
and yaml mode
.
Users should only have either branch_type
or branches
defined in their policy rule. They shouldn't ever have both in the same rule.
Relevant links
Scan execution policy design proposal
See parent epic for yaml mode
example.
Implementation plan
Can be broken down to multiple MR's according to plan below:
policy_rule_branch_selection.vue
is already used both by license_scan_rule_builder.vue
and security_scan_rule_builder.vue
.
It has two options now for specific branches
and all protected branches
-
Extend policy_rule_branch_selection.vue
to provide all options specified by design (all | protected || default
). -
Add ability to change list of options for policy_rule_branch_selection.vue
-
Allow policy_rule_branch_selection.vue
emit changes ofbranch_type
, so it can changeyaml mode
-
Make sure that both policy and yaml mode
work by following rules: - selecting branch_type modifies
yaml
mode -
Add validation in scan_execution_policy/lib/from_yaml.js
both for newbranch_type
key and also for possible values:all | protected || default
-
Allow policy_rule_branch_selection.vue
to accept saved branch_type so it is selected for existing policies and switching between modes
Verification steps
- Upload a GitLab Ultimate license
- Navigate to a group/project => Security & Compliance => Policies => New policy => Scan Execution Policy (e.g. gdk group/gdk project
- Verify changes
- Switch to
yaml mode
try some invalid values, make sure thatrule
still works
Edited by Alexander Turinske