debian-mirror-gitlab/doc/administration/issue_closing_pattern.md

111 lines
2.7 KiB
Markdown
Raw Normal View History

2020-10-24 23:57:45 +05:30
---
stage: Create
2021-04-17 20:07:23 +05:30
group: Code Review
2022-11-25 23:54:43 +05:30
info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments"
2020-10-24 23:57:45 +05:30
type: reference
---
2021-03-11 19:13:27 +05:30
# Issue closing pattern **(FREE SELF)**
2016-09-29 09:46:39 +05:30
2021-02-22 17:27:13 +05:30
NOTE:
2023-04-23 21:23:45 +05:30
This page explains how an administrator can configure issue closing patterns.
For user documentation about the feature, see
[Closing issues automatically](../user/project/issues/managing_issues.md#closing-issues-automatically).
2016-09-29 09:46:39 +05:30
When a commit or merge request resolves one or more issues, it is possible to
2021-04-17 20:07:23 +05:30
automatically close these issues when the commit or merge request lands
2016-09-29 09:46:39 +05:30
in the project's default branch.
## Change the issue closing pattern
2023-03-04 22:38:38 +05:30
The [default issue closing pattern](../user/project/issues/managing_issues.md#default-closing-pattern)
covers a wide range of words. You can change the pattern to suit your needs.
2016-09-29 09:46:39 +05:30
2021-02-22 17:27:13 +05:30
NOTE:
2023-04-23 21:23:45 +05:30
To test the issue closing pattern, use <https://rubular.com>.
However, Rubular doesn't understand `%{issue_ref}`. When testing your patterns,
replace this string with `#\d+`, which matches only local issue references like `#123`.
2016-09-29 09:46:39 +05:30
2023-03-04 22:38:38 +05:30
To change the default issue closing pattern:
::Tabs
2016-09-29 09:46:39 +05:30
2023-03-04 22:38:38 +05:30
:::TabTitle Linux package (Omnibus)
1. Edit `/etc/gitlab/gitlab.rb` and change the `gitlab_rails['gitlab_issue_closing_pattern']`
value:
2016-09-29 09:46:39 +05:30
2019-09-30 21:07:59 +05:30
```ruby
2023-03-04 22:38:38 +05:30
gitlab_rails['gitlab_issue_closing_pattern'] = /<regular_expression>/.source
```
1. Save the file and reconfigure GitLab:
```shell
sudo gitlab-ctl reconfigure
```
:::TabTitle Helm chart (Kubernetes)
1. Export the Helm values:
```shell
helm get values gitlab > gitlab_values.yaml
```
1. Edit `gitlab_values.yaml` and change the `issueClosingPattern` value:
```yaml
global:
appConfig:
issueClosingPattern: "<regular_expression>"
2019-09-30 21:07:59 +05:30
```
2023-03-04 22:38:38 +05:30
1. Save the file and apply the new values:
2016-09-29 09:46:39 +05:30
2023-03-04 22:38:38 +05:30
```shell
helm upgrade -f gitlab_values.yaml gitlab gitlab/gitlab
```
:::TabTitle Docker
1. Edit `docker-compose.yml` and change the `gitlab_rails['gitlab_issue_closing_pattern']`
value:
```yaml
version: "3.6"
services:
gitlab:
environment:
GITLAB_OMNIBUS_CONFIG: |
gitlab_rails['gitlab_issue_closing_pattern'] = /<regular_expression>/.source
```
1. Save the file and restart GitLab:
2016-09-29 09:46:39 +05:30
2023-03-04 22:38:38 +05:30
```shell
docker compose up -d
```
:::TabTitle Self-compiled (source)
1. Edit `/home/git/gitlab/config/gitlab.yml` and change the `issue_closing_pattern` value:
2016-09-29 09:46:39 +05:30
2019-09-30 21:07:59 +05:30
```yaml
2023-03-04 22:38:38 +05:30
production: &base
gitlab:
issue_closing_pattern: "<regular_expression>"
```
1. Save the file and restart GitLab:
```shell
# For systems running systemd
sudo systemctl restart gitlab.target
# For systems running SysV init
sudo service gitlab restart
2019-09-30 21:07:59 +05:30
```
2016-09-29 09:46:39 +05:30
2023-03-04 22:38:38 +05:30
::EndTabs