summaryrefslogtreecommitdiff
path: root/doc/ci
diff options
context:
space:
mode:
authorWolphin <wolphin@wolph.in>2019-06-05 08:25:55 +0000
committerKamil TrzciƄski <ayufan@ayufan.eu>2019-06-05 08:25:55 +0000
commit1f2244f16bc2990000a77911520b0c06095522c2 (patch)
tree1e920c31d012cb4f928397b467739e0499de83ea /doc/ci
parentdf549eb28c83b27500619ccb14c201a4ff87daa3 (diff)
downloadgitlab-ce-1f2244f16bc2990000a77911520b0c06095522c2.tar.gz
Add multiple extends support
Diffstat (limited to 'doc/ci')
-rw-r--r--doc/ci/yaml/README.md44
1 files changed, 42 insertions, 2 deletions
diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md
index 18c85618b1b..3731585b4e5 100644
--- a/doc/ci/yaml/README.md
+++ b/doc/ci/yaml/README.md
@@ -108,7 +108,7 @@ The following table lists available parameters for jobs:
| [`parallel`](#parallel) | How many instances of a job should be run in parallel. |
| [`trigger`](#trigger-premium) | Defines a downstream pipeline trigger. |
| [`include`](#include) | Allows this job to include external YAML files. Also available: `include:local`, `include:file`, `include:template`, and `include:remote`. |
-| [`extends`](#extends) | Configuration entry that this job is going to inherit from. |
+| [`extends`](#extends) | Configuration entries that this job is going to inherit from. |
| [`pages`](#pages) | Upload the result of a job to use with GitLab Pages. |
| [`variables`](#variables) | Define job variables on a job level. |
@@ -2117,7 +2117,7 @@ docker-test:
> Introduced in GitLab 11.3.
-`extends` defines an entry name that a job that uses `extends` is going to
+`extends` defines entry names that a job that uses `extends` is going to
inherit from.
It is an alternative to using [YAML anchors](#anchors) and is a little
@@ -2194,6 +2194,46 @@ spinach:
script: rake spinach
```
+It's also possible to use multiple parents for `extends`.
+The algorithm used for merge is "closest scope wins", so keys
+from the last member will always shadow anything defined on other levels.
+For example:
+
+```yaml
+.only-important:
+ only:
+ - master
+ - stable
+ tags:
+ - production
+
+.in-docker:
+ tags:
+ - docker
+ image: alpine
+
+rspec:
+ extends:
+ - .only-important
+ - .in-docker
+ script:
+ - rake rspec
+```
+
+This results in the following `rspec` job:
+
+```yaml
+rspec:
+ only:
+ - master
+ - stable
+ tags:
+ - docker
+ image: alpine
+ script:
+ - rake rspec
+```
+
### Using `extends` and `include` together
`extends` works across configuration files combined with `include`.