Add validation for if file exists
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 | |
empty file name | |
no project selected | |
file does not exist | |
valid file |
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Upload a GitLab Ultimate license
- Enable the feature flag
echo "Feature.enable(:compliance_pipeline_in_policies)" | rails c
. - Create a group => Settings => General => Permissions and group features section
- Enable Run customized CI YAML file as security policy actions and save
- Navigate to a project => Create a .yml file in it
- Navigate to a project in the group => Secure => Policies => New policy => Scan Execution Policy
- Add new action => Run CI/CD code => Run "Linked existing CI file"
- Select the current project and the branch with the .yml file
- Mistype the file name
- Verify the validation fails (the ref and file name inputs are outlined in red)
- Type in the correct file name
- Verify the validation succeeds (nothing is outlined in red)
- Change the branch to one without the .yml file
- Verify the validation fails (the ref and file name inputs are outlined in red)
- Unselect the project
- Verify the validation succeeds (no validation should happen without a project selected)
Related to #432422 (closed)
Edited by Alexander Turinske