Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-13 21:08:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-13 21:08:06 +0300
commit7cc6c10c68915f5019ab8c2029eeb462c8fed4ef (patch)
tree419e5fee5bb60e71bef076157627812d54e142bc /doc/ci/merge_request_pipelines
parent630101f7f93847f39a4d2f87d92f514c973cdc1e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/ci/merge_request_pipelines')
-rw-r--r--doc/ci/merge_request_pipelines/index.md30
1 files changed, 30 insertions, 0 deletions
diff --git a/doc/ci/merge_request_pipelines/index.md b/doc/ci/merge_request_pipelines/index.md
index 7a7fa08fac1..9ac41f88ff6 100644
--- a/doc/ci/merge_request_pipelines/index.md
+++ b/doc/ci/merge_request_pipelines/index.md
@@ -134,6 +134,36 @@ to add that `only:` rule to all of your jobs in order to make them always run. Y
can use this for scenarios like having only pipelines with merge requests get a
Review App set up, helping to save resources.
+## Excluding certain branches
+
+Pipelines for merge requests require special treatement when
+using [`only`/`except`](../yaml/README.md#onlyexcept-basic). Unlike ordinary
+branch refs (for example `refs/heads/my-feature-branch`), merge request refs
+use a special Git reference that looks like `refs/merge-requests/:iid/head`. Because
+of this, the following configuration will **not** work as expected:
+
+```yaml
+# Does not exclude a branch named "docs-my-fix"!
+test:
+ only: [merge_requests]
+ except: [/^docs-/]
+```
+
+Instead, you can use the
+[`$CI_COMMIT_REF_NAME` predefined environment
+variable](../variables/predefined_variables.md#variables-reference) in
+combination with
+[`only:variables`](../yaml/README.md#onlyvariablesexceptvariables) to
+accomplish this behavior:
+
+```yaml
+test:
+ only: [merge_requests]
+ except:
+ variables:
+ $CI_COMMIT_REF_NAME =~ /^docs-/
+```
+
## Important notes about merge requests from forked projects
Note that the current behavior is subject to change. In the usual contribution