Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a7e0e425
Commit
a7e0e425
authored
Dec 13, 2019
by
Nathan Friend
Committed by
Marcia Ramos
Dec 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add example of .gitlab-ci.yml that uses only: [merge_requests] and excludes specific branches
parent
de317be5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
doc/ci/merge_request_pipelines/index.md
doc/ci/merge_request_pipelines/index.md
+30
-0
No files found.
doc/ci/merge_request_pipelines/index.md
View file @
a7e0e425
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment