diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-13 18:08:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-13 18:08:06 +0000 |
commit | 7cc6c10c68915f5019ab8c2029eeb462c8fed4ef (patch) | |
tree | 419e5fee5bb60e71bef076157627812d54e142bc /doc/ci | |
parent | 630101f7f93847f39a4d2f87d92f514c973cdc1e (diff) | |
download | gitlab-ce-7cc6c10c68915f5019ab8c2029eeb462c8fed4ef.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/ci')
-rw-r--r-- | doc/ci/merge_request_pipelines/index.md | 30 |
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 |