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:
authorEvan Read <eread@gitlab.com>2019-02-12 03:11:45 +0300
committerGitLab Release Tools Bot <robert+release-tools@gitlab.com>2019-02-12 19:33:14 +0300
commit27ed71e4642b518eb633b768899644cd1bef7679 (patch)
tree5a0781bef67d70f80a700ef482551aa492cc7d53
parente0d9b8820678fb9ab04bf493f6ef354d170c7ab8 (diff)
Merge branch '57287-documentation-for-handling-more-complex-only-merge_requests-scenarios-is-sparse' into 'master'
Docs for MR pipeline rule interactions Closes #57287 See merge request gitlab-org/gitlab-ce!24929 (cherry picked from commit ce91920819bdd8bc41e5c76ca1a67ef32486d1c8) 04e861af Add new section describing usage in exclusion scenario 82685510 Rename section header to be more clear cc0378c4 Apply suggestion to doc/ci/merge_request_pipelines/index.md 701e285e Apply suggestion to doc/ci/merge_request_pipelines/index.md 43b69682 Apply suggestion to doc/ci/merge_request_pipelines/index.md 9b2981fb Apply suggestion to doc/ci/merge_request_pipelines/index.md 42c9e397 Apply suggestion to doc/ci/merge_request_pipelines/index.md 98569488 Apply suggestion to doc/ci/merge_request_pipelines/index.md ba1b2ab9 Apply suggestion to doc/ci/merge_request_pipelines/index.md 71597f9b Apply suggestion to doc/ci/merge_request_pipelines/index.md 4a2a9591 Small grammar fix
-rw-r--r--doc/ci/merge_request_pipelines/index.md43
1 files changed, 43 insertions, 0 deletions
diff --git a/doc/ci/merge_request_pipelines/index.md b/doc/ci/merge_request_pipelines/index.md
index bf1e61442d4..b7b5c660586 100644
--- a/doc/ci/merge_request_pipelines/index.md
+++ b/doc/ci/merge_request_pipelines/index.md
@@ -56,6 +56,49 @@ The same tag is shown on the pipeline's details:
![Pipeline's details](img/pipeline_detail.png)
+## Excluding certain jobs
+
+The behavior of the `only: merge_requests` rule is such that _only_ jobs with
+that rule are run in the context of a merge request; no other jobs will be run.
+
+However, you may want to reverse this behaviour, having all of your jobs to run _except_
+for one or two. Consider the following pipeline, with jobs `A`, `B`, and `C`. If you want
+all pipelines to always run `A` and `B`, but only want `C` to run for a merge request,
+you can configure your `.gitlab-ci.yml` file as follows:
+
+``` yaml
+.only-default: &only-default
+ only:
+ - master
+ - merge_requests
+ - tags
+
+A:
+ <<: *only-default
+ script:
+ - ...
+
+B:
+ <<: *only-default
+ script:
+ - ...
+
+C:
+ script:
+ - ...
+ only:
+ - merge_requests
+```
+
+Since `A` and `B` are getting the `only:` rule to execute in all cases, they will
+always run. `C` specifies that it should only run for merge requests, so for any
+pipeline except a merge request pipeline, it will not run.
+
+As you can see, this will help you avoid a lot of boilerplate where you'd need
+to add that `only:` rule to all of your jobs in order to make them always run. You
+can use this for scenarios like having only pipelines with merge requests get a
+Review App set up, helping to save resources.
+
## Important notes about merge requests from forked projects
Note that the current behavior is subject to change. In the usual contribution