diff options
author | Evan Read <eread@gitlab.com> | 2019-01-30 10:20:50 +0000 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2019-01-30 10:20:50 +0000 |
commit | cdd5a4880cc462f7a9166374750f33ed59ad9cc4 (patch) | |
tree | a090b0ddefea40a9ee7cd1ace75e0b90d1a9c669 /doc/ci/variables | |
parent | 6fc5495703f2e9674cdda40826340be4a61047b6 (diff) | |
download | gitlab-ce-cdd5a4880cc462f7a9166374750f33ed59ad9cc4.tar.gz |
Documentation now matches UI copy
Diffstat (limited to 'doc/ci/variables')
-rw-r--r-- | doc/ci/variables/README.md | 63 | ||||
-rw-r--r-- | doc/ci/variables/img/variables.png | bin | 34838 -> 0 bytes |
2 files changed, 34 insertions, 29 deletions
diff --git a/doc/ci/variables/README.md b/doc/ci/variables/README.md index ac46e0eedc6..45667caf65d 100644 --- a/doc/ci/variables/README.md +++ b/doc/ci/variables/README.md @@ -4,27 +4,33 @@ table_display_block: true # GitLab CI/CD Variables -When receiving a job from GitLab CI, the [Runner] prepares the build environment. -It starts by setting a list of **predefined variables** (environment variables) -and a list of **user-defined variables**. +When receiving a job from GitLab CI, the [Runner](https://docs.gitlab.com/runner/) prepares the build environment. +It starts by setting a list of: + +- [Predefined environment variables](#predefined-environment-variables). +- Other variables. ## Priority of variables -The variables can be overwritten and they take precedence over each other in -this order: +Variables of different types can take precedence over other variables, depending on where they are defined. + +The order of precedence for variables is (from highest to lowest): + +1. [Trigger variables](../triggers/README.md#pass-job-variables-to-a-trigger) or [scheduled pipeline variables](../../user/project/pipelines/schedules.md#making-use-of-scheduled-pipeline-variables). +1. Project-level [variables](#variables) or [protected variables](#protected-variables). +1. Group-level [variables](#variables) or [protected variables](#protected-variables). +1. YAML-defined [job-level variables](../yaml/README.md#variables). +1. YAML-defined [global variables](../yaml/README.md#variables). +1. [Deployment variables](#deployment-variables). +1. [Predefined environment variables](#predefined-environment-variables). -1. [Trigger variables][triggers] or [scheduled pipeline variables](../../user/project/pipelines/schedules.md#making-use-of-scheduled-pipeline-variables) (take precedence over all) -1. Project-level [variables](#variables) or [protected variables](#protected-variables) -1. Group-level [variables](#variables) or [protected variables](#protected-variables) -1. YAML-defined [job-level variables](../yaml/README.md#variables) -1. YAML-defined [global variables](../yaml/README.md#variables) -1. [Deployment variables](#deployment-variables) -1. [Predefined variables](#predefined-variables-environment-variables) (are the - lowest in the chain) +For example, you define: -For example, if you define `API_TOKEN=secure` as a project variable and -`API_TOKEN=yaml` in your `.gitlab-ci.yml`, the `API_TOKEN` will take the value -`secure` as the project variables are higher in the chain. +- `API_TOKEN=secure` as a project variable. +- `API_TOKEN=yaml` in your `.gitlab-ci.yml`. + +`API_TOKEN` will take the value `secure` as the project variables take precedence over those defined +in `.gitlab-ci.yml`. ## Unsupported variables @@ -32,10 +38,10 @@ There are cases where some variables cannot be used in the context of a `.gitlab-ci.yml` definition (for example under `script`). Read more about which variables are [not supported](where_variables_can_be_used.md). -## Predefined variables (Environment variables) +## Predefined environment variables Some of the predefined environment variables are available only if a minimum -version of [GitLab Runner][runner] is used. Consult the table below to find the +version of [GitLab Runner](https://docs.gitlab.com/runner/) is used. Consult the table below to find the version of Runner required. NOTE: **Note:** @@ -160,7 +166,7 @@ This feature requires GitLab Runner 0.5.0 or higher and GitLab 7.14 or higher. GitLab CI allows you to add to `.gitlab-ci.yml` variables that are set in the build environment. The variables are hence saved in the repository, and they -are meant to store non-sensitive project configuration, e.g., `RAILS_ENV` or +are meant to store non-sensitive project configuration. For example, `RAILS_ENV` or `DATABASE_URL`. For example, if you set the variable below globally (not inside a job), it will @@ -208,16 +214,18 @@ GitLab CI allows you to define per-project or per-group variables that are set in the pipeline environment. The variables are stored out of the repository (not in `.gitlab-ci.yml`) and are securely passed to GitLab Runner making them available during a pipeline run. It's the recommended method to -use for storing things like passwords, SSH keys and credentials. +use for storing things like passwords, SSH keys, and credentials. + +Project-level variables can be added by: -Project-level variables can be added by going to your project's -**Settings > CI/CD**, then finding the section called **Variables**. +1. Navigating to your project's **Settings > CI/CD** page. +1. Inputing variable keys and values in the **Environment variables** section. -Likewise, group-level variables can be added by going to your group's -**Settings > CI/CD**, then finding the section called **Variables**. -Any variables of [subgroups] will be inherited recursively. +Group-level variables can be added by: -![Variables](img/variables.png) +1. Navigating to your group's **Settings > CI/CD** page. +1. Inputing variable keys and values in the **Environment variables** section. Any variables of + [subgroups](../../user/group/subgroups/index.md) will be inherited recursively. Once you set them, they will be available for all subsequent pipelines. You can also [protect your variables](#protected-variables). @@ -621,11 +629,8 @@ Below you can find supported syntax reference: [envs]: ../environments.md [protected branches]: ../../user/project/protected_branches.md [protected tags]: ../../user/project/protected_tags.md -[runner]: https://docs.gitlab.com/runner/ [shellexecutors]: https://docs.gitlab.com/runner/executors/ [triggered]: ../triggers/README.md -[triggers]: ../triggers/README.md#pass-job-variables-to-a-trigger -[subgroups]: ../../user/group/subgroups/index.md [builds-policies]: ../yaml/README.md#only-and-except-complex [gitlab-deploy-token]: ../../user/project/deploy_tokens/index.md#gitlab-deploy-token [registry]: ../../user/project/container_registry.md diff --git a/doc/ci/variables/img/variables.png b/doc/ci/variables/img/variables.png Binary files differdeleted file mode 100644 index 0795f7c888f..00000000000 --- a/doc/ci/variables/img/variables.png +++ /dev/null |