Skip to content

Add policy name to ScanExecutionPolicyCommit mutation

Sashi Kumar Kumaresan requested to merge sk/339794-update-policy-name-be into master

What does this MR do and why?

Addresses #339794 (closed)

This MR adds a new argument name to ScanExecutionPolicyCommit mutation. Since we do not have a reference to a policy in the yaml file in policy project, the name of the policy is considered as an unique identifier. But if the name of the policy need to be updated, the old name has to mentioned explicitly to make it work.

Screenshots or screen recordings

Update policy name:

Screenshot_2021-10-08_at_2.32.54_PM

Different name while creating policy:

Screenshot_2021-10-08_at_2.34.27_PM

How to set up and validate locally

Policy
scan_execution_policy:
- name: Policy
  description: This policy enforces pipeline configuration to have a job with secret detection scan
  enabled: true
  rules:
  - type: pipeline
    branches:
    - master
  actions:
  - scan: secret_detection
  • Go to graphql explorer and execute the mutation:
Mutation
mutation createPolicy{
  scanExecutionPolicyCommit(input:{
    projectPath:"root/security-test",
    operationMode:REPLACE,
    name: "New Policy"
    policyYaml: "name: Policy\ntype: scan_execution_policy\ndescription: This policy enforces pipeline configuration to have a job with secret detection scan\nenabled: true\nrules:\n- type: pipeline\n  branches: \n    - master\nactions:\n- scan: secret_detection"
  }) {
    clientMutationId
    branch
    errors
  }
} 

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Sashi Kumar Kumaresan

Merge request reports