Fix yaml schema validation for scan result policy
What does this MR do and why?
Fix yaml schema validation for scan result policy
- the name of the scan result policy was updated to approval policy
- to allow for both names to work, the properties were moved into a shared reference (Add support for approval_settings and any_merge... (!130189 - merged))
- update frontend to find properties in that shared reference
- update frontend to fail gracefully for policies that are not in the schema
- update tests to be more robust
Changelog: fixed
EE: true
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.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Upload a GitLab Ultimate license
- Apply the following patch
Patch
diff --git a/app/assets/javascripts/editor/extensions/source_editor_security_policy_schema_ext.js b/app/assets/javascripts/editor/extensions/source_editor_security_policy_schema_ext.js
index 1647b0ec457c..684f9ef07dd9 100644
--- a/app/assets/javascripts/editor/extensions/source_editor_security_policy_schema_ext.js
+++ b/app/assets/javascripts/editor/extensions/source_editor_security_policy_schema_ext.js
@@ -63,6 +63,7 @@ export class SecurityPolicySchemaExtension {
});
const modelFileName = instance.getModel().uri.path.split('/').pop();
+ console.log(singlePolicySchema);
registerSchema({
uri: getSecurityPolicySchemaUrl({ namespacePath, namespaceType }),
schema: singlePolicySchema,
- Navigate to a project => Secure => Policies => New policy
- Select Scan Execution policy => Open the developer console ( CMD + OPTION + k )
- Navigate to yaml mode
- Ignore the errors; they will be addressed in Security Policy yaml validation does not work w... (#461252 - closed).
- Verify the console log has the
properties
value - Navigate back to the selector page => Select Merge request approval policy => Open the developer console ( CMD + OPTION + k )
- Navigate to yaml mode
- Ignore the errors; they will be addressed in Security Policy yaml validation does not work w... (#461252 - closed).
- Verify the console log has the
properties
value
Related to #457789 (closed)
Edited by Alexander Turinske