Improve error handling for branch exceptions
Summary
- Unclear branch type errors are showing up when there is a branch exception
- Branch exception errors are showing up in the wrong place
Examples
- When trying to save policies with all protected branches chosen as exceptions
Steps to reproduce
- Navigate to a project => Settings => Repository => Protected Branches
- Protect some branches
- Navigate to Secure => Policies => New Policy => Scan Result
- Select any policy type, select
All protected branches
, add all of the branches to the exception section - Save the policy
Example Project
https://gitlab.com/haven-group/security-group/security-policy-project-management
What is the current bug behavior?
- Unclear branch type errors are showing up when there is a branch exception
- Branch exception errors are showing up in the wrong place
What is the expected correct behavior?
- Branch type errors should be clearer
- Branch type errors show at the top of the page
Relevant logs and/or screenshots
type: scan_result_policy
name: test
description: ''
enabled: true
rules:
- type: any_merge_request
branch_type: protected
commits: any
branch_exceptions:
- main
actions:
- type: require_approval
approvals_required: 1
role_approvers:
- owner
- maintainer
approval_settings:
prevent_approval_by_author: true
prevent_approval_by_commit_author: true
remove_approvals_with_new_commit: true
require_password_to_approve: false
Output of checks
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)
Possible fixes
Edited by Grant Hickman