gitlab-org--gitlab-foss/spec/lib
Kamil Trzciński fc6ee35928 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
2016-03-22 09:42:40 +00:00
..
banzai Merge branch 'master' into issue_12658 2016-03-21 23:22:21 +01:00
ci Merge branch 'feature-ci-only-except-trigger' into 'master' 2016-03-22 09:42:40 +00:00
gitlab Find referable for each ref found in references rewriter 2016-03-20 10:52:01 +01:00
disable_email_interceptor_spec.rb Tag lib specs 2015-12-09 11:55:42 +01:00
extracts_path_spec.rb Tag lib specs 2015-12-09 11:55:42 +01:00
file_size_validator_spec.rb Tag lib specs 2015-12-09 11:55:42 +01:00
git_ref_validator_spec.rb Tag lib specs 2015-12-09 11:55:42 +01:00
repository_cache_spec.rb Tag lib specs 2015-12-09 11:55:42 +01:00