From 1fa79760ad2d4bd67f5c5a27f372a7533b9b7c69 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 10 Mar 2020 12:08:16 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- doc/ci/variables/predefined_variables.md | 2 +- doc/ci/yaml/README.md | 56 +++++++++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 6 deletions(-) (limited to 'doc/ci') diff --git a/doc/ci/variables/predefined_variables.md b/doc/ci/variables/predefined_variables.md index 65381d512e5..a340f8b705d 100644 --- a/doc/ci/variables/predefined_variables.md +++ b/doc/ci/variables/predefined_variables.md @@ -33,7 +33,7 @@ future GitLab releases.** | `CI_COMMIT_DESCRIPTION` | 10.8 | all | The description of the commit: the message without first line, if the title is shorter than 100 characters; full message in other case. | | `CI_COMMIT_MESSAGE` | 10.8 | all | The full commit message. | | `CI_COMMIT_REF_NAME` | 9.0 | all | The branch or tag name for which project is built | -| `CI_COMMIT_REF_PROTECTED` | 11.11 | all | `true` if the job is running on a protected branch, `false` if not | +| `CI_COMMIT_REF_PROTECTED` | 11.11 | all | `true` if the job is running on a protected reference, `false` if not | | `CI_COMMIT_REF_SLUG` | 9.0 | all | `$CI_COMMIT_REF_NAME` lowercased, shortened to 63 bytes, and with everything except `0-9` and `a-z` replaced with `-`. No leading / trailing `-`. Use in URLs, host names and domain names. | | `CI_COMMIT_SHA` | 9.0 | all | The commit revision for which project is built | | `CI_COMMIT_SHORT_SHA` | 11.7 | all | The first eight characters of `CI_COMMIT_SHA` | diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index d4d3127b444..10f35a4afcf 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -165,33 +165,79 @@ rspec 2.6: You can disable inheritance of globally defined defaults and variables with the `inherit:` parameter. +To enable or disable the inheritance of all `variables:` or `default:` parameters, use the following format: + +- `default: true` or `default: false` +- `variables: true` or `variables: false` + +To inherit only a subset of `default:` parameters or `variables:`, specify what +you wish to inherit, and any not listed will **not** be inherited. Use +one of the following formats: + +```yaml +inherit: + default: [parameter1, parameter2] + variables: [VARIABLE1, VARIABLE2] +``` + +Or: + +```yaml +inherit: + default: + - parameter1 + - parameter2 + variables: + - VARIABLE1 + - VARIABLE2 +``` + In the example below: -- `rubocop` **will** inherit both the `before_script` and the variable `DOMAIN`. -- `rspec` **will not** inherit the `before_script` or the variable `DOMAIN`. -- `capybara` **will** inherit the `before_script`, but **will not** inherit the variable `DOMAIN`. +- `rubocop`: + - **will** inherit: Nothing. +- `rspec`: + - **will** inherit: the default `image` and the `WEBHOOK_URL` variable. + - **will not** inherit: the default `before_script` and the `DOMAIN` variable. +- `capybara`: + - **will** inherit: the default `before_script` and `image`. + - **will not** inherit: the `DOMAIN` and `WEBHOOK_URL` variables. +- `karma`: + - **will** inherit: the default `image` and `before_script`, and the `DOMAIN` variable. + - **will not** inherit: `WEBHOOK_URL` variable. ```yaml default: + image: 'ruby:2.4' before_script: - echo Hello World variables: DOMAIN: example.com + WEBHOOK_URL: https://my-webhook.example.com rubocop: + inherit: + default: false + variables: false script: bundle exec rubocop rspec: inherit: - default: false - variables: false + default: [image] + variables: [WEBHOOK_URL] script: bundle exec rspec capybara: inherit: variables: false script: bundle exec capybara + +karma: + inherit: + default: true + variables: [DOMAIN] + script: karma ``` ## Parameter details -- cgit v1.2.1