Issue closing pattern
- Tier: Free, Premium, Ultimate
- Offering: GitLab Self-Managed
This page explains how an administrator can configure issue closing patterns. For user documentation about the feature, see Closing issues automatically.
When a commit or merge request resolves one or more issues, GitLab can close those 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.
To change the default issue closing pattern to suit your needs:
Edit
/etc/gitlab/gitlab.rb
and 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.yaml
and change theissueClosingPattern
value: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.yml
and 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.yml
and change theissue_closing_pattern
value: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
To test the issue closing pattern, use Rubular.
Rubular does not understand %{issue_ref}
. When you test your patterns,
replace this string with #\d+
, which matches only local issue references like #123
.
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support