Issue closing pattern
When a commit or merge request resolves one or more issues, it is possible to automatically close these issues when the commit or merge request lands in the project’s default branch.
Change the issue closing pattern
The default issue closing pattern covers a wide range of words. You can change the pattern to suit your needs.
%{issue_ref}, you can replace this by
#\d+ when testing your patterns, which matches only local issue references like #123.To change the default issue closing pattern:
-
Edit
/etc/gitlab/gitlab.rband change thegitlab_rails['gitlab_issue_closing_pattern']value:gitlab_rails['gitlab_issue_closing_pattern'] = /<regular_expression>/.source -
Save the file and reconfigure GitLab:
sudo gitlab-ctl reconfigure
-
Export the Helm values:
helm get values gitlab > gitlab_values.yaml -
Edit
gitlab_values.yamland change theissueClosingPatternvalue:global: appConfig: issueClosingPattern: "<regular_expression>" -
Save the file and apply the new values:
helm upgrade -f gitlab_values.yaml gitlab gitlab/gitlab
-
Edit
docker-compose.ymland change thegitlab_rails['gitlab_issue_closing_pattern']value:version: "3.6" services: gitlab: environment: GITLAB_OMNIBUS_CONFIG: | gitlab_rails['gitlab_issue_closing_pattern'] = /<regular_expression>/.source -
Save the file and restart GitLab:
docker compose up -d
-
Edit
/home/git/gitlab/config/gitlab.ymland change theissue_closing_patternvalue:production: &base gitlab: issue_closing_pattern: "<regular_expression>" -
Save the file and restart GitLab:
# For systems running systemd sudo systemctl restart gitlab.target # For systems running SysV init sudo service gitlab restart