summaryrefslogtreecommitdiff
path: root/doc/ci
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2016-03-22 09:42:40 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2016-03-22 09:42:40 +0000
commitfc6ee359287c6bd286e32ce808e7069714e1732e (patch)
treec4a4d3a5e0bef652c364dcb3f4b9f9ff63d8c87e /doc/ci
parent383ead5d58a0553b7700aa922ad67c41b16eadf7 (diff)
parent5adaabdd30388993ce547a782146d166d30cfc9b (diff)
downloadgitlab-ce-fc6ee359287c6bd286e32ce808e7069714e1732e.tar.gz
Merge branch 'feature-ci-only-except-trigger' into 'master'
CI: Add 'triggers' keyword to 'only' and 'except' lists to allow control over when triggers cause builds to run Currently, the `only` and `except` keywords in `.gitlab-ci.yml` only accept ref names or the special `branches` and `tags` keywords. However, these are primarily useful when controlling how repository activity affects the creation of builds. In my case, instead of building on every commit, I'd like to use the following logic: - If the repository is tagged, do a build. - Any other normal commits should not cause a build. - If a build is triggered via the API, always create one for the specified ref. From what I can tell, this isn't possible via the existing YAML syntax. In this MR, I introduce a new keyword `triggers` that goes along with `branches` and `tags`. I can implement the logic above using the following job configuration: ```yaml only: - tags - triggers ``` I updated the tests and documentation to reflect this and everything seems to pass. See merge request !3230
Diffstat (limited to 'doc/ci')
-rw-r--r--doc/ci/yaml/README.md13
1 files changed, 12 insertions, 1 deletions
diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md
index 762b35859b9..4316f3c1f64 100644
--- a/doc/ci/yaml/README.md
+++ b/doc/ci/yaml/README.md
@@ -331,7 +331,7 @@ There are a few rules that apply to the usage of refs policy:
* `only` and `except` are inclusive. If both `only` and `except` are defined
in a job specification, the ref is filtered by `only` and `except`.
* `only` and `except` allow the use of regular expressions.
-* `only` and `except` allow the use of special keywords: `branches` and `tags`.
+* `only` and `except` allow the use of special keywords: `branches`, `tags`, and `triggers`.
* `only` and `except` allow to specify a repository path to filter jobs for
forks.
@@ -348,6 +348,17 @@ job:
- branches
```
+In this example, `job` will run only for refs that are tagged, or if a build is explicitly requested
+via an API trigger.
+
+```yaml
+job:
+ # use special keywords
+ only:
+ - tags
+ - triggers
+```
+
The repository path can be used to have jobs executed only for the parent
repository and not forks: