Require expression in commit messages regular expression stops the creation of Scan Execution Policy
Summary
Consider the following hierarchy:
.
└── group1
└── project1
On group1
a Pre-defined push rule is set up as follows:
-
Require expression in commit messages
:MPT-\d+
When trying to create a new policy in project1
using Secure
> Policies
> create a new policy
(Scan Execution Policy) the policy creation fails with the error
13:update reference: running pre-receive hooks: GitLab: Commit message does not follow the pattern 'MPT-\d+'
The reason for this is that the policy project that is being created during this action inherits the Pre-defined push rules
and as there is no way to change the commit message for the commit in that policy project during the creation the commit is rejected.
The commit message in question here would be Add a new policy to .gitlab/security-policies/policy.yml
Steps to reproduce
- create a new sub-group (
group1
) - create a new project in group1 (
project1
) - Add the following Pre-defined push rule
:
Require expression in commit messages:
MPT-\d+in
group1` - in
project1
useSecure
>Policies
>create a new policy
(Scan Execution Policy)
Example Project
What is the current bug behavior?
As it is not possible to configure the commit message during the policy creation the Pre-defined push rules
can cause the policy creation to fail.
What is the expected correct behavior?
Policy creation should always be possible regardless of any Pre-defined push rules
Relevant logs and/or screenshots
13:update reference: running pre-receive hooks: GitLab: Commit message does not follow the pattern 'MPT-\d+'
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
Workarounds
Exclude security policy projects from push rules being enforced.