Skip to content

Add validation for if file exists

Alexander Turinske requested to merge 432422-add-file-path-validation into master

What does this MR do and why?

Add validation for if file exists

  • update validation message
  • prioritize empty string message

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.

Scenario Screenshot
video validation
initial initial
empty file name empty_file_path
no project selected no_project
file does not exist bad_ref
valid file success

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Upload a GitLab Ultimate license
  2. Enable the feature flag echo "Feature.enable(:compliance_pipeline_in_policies)" | rails c.
  3. Create a group => Settings => General => Permissions and group features section
  4. Enable Run customized CI YAML file as security policy actions and save
  5. Navigate to a project => Create a .yml file in it
  6. Navigate to a project in the group => Secure => Policies => New policy => Scan Execution Policy
  7. Add new action => Run CI/CD code => Run "Linked existing CI file"
  8. Select the current project and the branch with the .yml file
  9. Mistype the file name
  10. Verify the validation fails (the ref and file name inputs are outlined in red)
  11. Type in the correct file name
  12. Verify the validation succeeds (nothing is outlined in red)
  13. Change the branch to one without the .yml file
  14. Verify the validation fails (the ref and file name inputs are outlined in red)
  15. Unselect the project
  16. Verify the validation succeeds (no validation should happen without a project selected)

Related to #432422 (closed)

Edited by Alexander Turinske

Merge request reports