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
path: root/doc/ci/yaml
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2016-03-22 12:42:40 +0300
committerRémy Coutable <remy@rymai.me>2016-03-22 14:34:20 +0300
commit0fcea6b660f92d6f97ce4b2c36f899cd97a0edec (patch)
treed166425accc430e174773e5bb1ebdd8ee6ce27d5 /doc/ci/yaml
parent9684d7fd99e881ee5900bee74718f170b9d68891 (diff)
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/yaml')
-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: