Invalid YAML when using new_needs_triage and new_dismissed
Summary
This is on GitLab.com. I created a new Merge Request approval policy for a License Scan today. The generated YAML still uses the deprecated newly_detected. I edited the policy.yml and replaced newly_detected with new_needs_triage and new_dismissed. Now, when I go to view the policy from the Policies page, I see nothing under Detail. When I click on Edit Policy, I get the error: Could not fetch policy because existing policy YAML is invalid
Here's the updated YAML.
name: License check
description: ''
enabled: true
actions:
- type: require_approval
approvals_required: 1
group_approvers_ids:
- 7887031
- type: send_bot_message
enabled: true
rules:
- type: license_finding
match_on_inclusion_license: true
license_types:
- GNU General Public License v2.0 or later
license_states:
- new_needs_triage
- new_dismissed
- detected
branch_type: default
approval_settings:
block_branch_modification: false
prevent_pushing_and_force_pushing: false
fallback_behavior:
fail: closed
Steps to reproduce
- Created a new Merge Request approval policy for a License Scan
- View the created policies YAML, note the use of newly_detected which is deprecated
- Modify the policy in YAML mode to replace newly_detected with new_needs_triage and new_dismissed.
- Save and merge.
-
View the updated policies YAML, note the empty Detail tab.see note - Try to edit the policy --> error:
Could not fetch policy because existing policy YAML is invalid
Example Project
My private projects, please request access:
- https://gitlab.com/edmond-demo/sandbox/secure-spring/
- https://gitlab.com/edmond-demo/sandbox/secure-spring-security-policy-project
What is the current bug behavior?
- Generated YAML includes deprecated syntax
newly_detected
-
Detail tab empty when new syntax is usedsee note - Use of new syntax is not determined to be invalid by the system
What is the expected correct behavior?
- Generated YAML does not use deprecated syntax
- Detail tab displays properly with use of new syntax
✅ - Use of new syntax is determined to be valid by the system
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)