Commit 71242199 authored by Marcia Ramos's avatar Marcia Ramos

Merge branch 'secret-variables-name' into 'master'

Rename Secret variables -> variables

See merge request gitlab-org/gitlab-ce!19309
parents af9cc234 3c9686c9
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
.settings-header .settings-header
%h4 %h4
= _('Variables') = _('Variables')
= link_to icon('question-circle'), help_page_path('ci/variables/README', anchor: 'secret-variables'), target: '_blank', rel: 'noopener noreferrer' = link_to icon('question-circle'), help_page_path('ci/variables/README', anchor: 'variables'), target: '_blank', rel: 'noopener noreferrer'
%button.btn.btn-default.js-settings-toggle{ type: "button" } %button.btn.btn-default.js-settings-toggle{ type: "button" }
= expanded ? _('Collapse') : _('Expand') = expanded ? _('Collapse') : _('Expand')
%p.append-bottom-0 %p.append-bottom-0
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
.settings-header .settings-header
%h4 %h4
= _('Variables') = _('Variables')
= link_to icon('question-circle'), help_page_path('ci/variables/README', anchor: 'secret-variables'), target: '_blank', rel: 'noopener noreferrer' = link_to icon('question-circle'), help_page_path('ci/variables/README', anchor: 'variables'), target: '_blank', rel: 'noopener noreferrer'
%button.btn.js-settings-toggle{ type: 'button' } %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand' = expanded ? 'Collapse' : 'Expand'
%p.append-bottom-0 %p.append-bottom-0
......
...@@ -162,7 +162,7 @@ configuration. Then customize everything from buildpacks to CI/CD. ...@@ -162,7 +162,7 @@ configuration. Then customize everything from buildpacks to CI/CD.
- [Auto DevOps](topics/autodevops/index.md) - [Auto DevOps](topics/autodevops/index.md)
- [Deployment of Helm, Ingress, and Prometheus on Kubernetes](user/project/clusters/index.md#installing-applications) - [Deployment of Helm, Ingress, and Prometheus on Kubernetes](user/project/clusters/index.md#installing-applications)
- [Protected secret variables](ci/variables/README.md#protected-secret-variables) - [Protected variables](ci/variables/README.md#protected-variables)
- [Easy creation of Kubernetes clusters on GKE](user/project/clusters/index.md#adding-and-creating-a-new-gke-cluster-via-gitlab) - [Easy creation of Kubernetes clusters on GKE](user/project/clusters/index.md#adding-and-creating-a-new-gke-cluster-via-gitlab)
### Monitor ### Monitor
......
...@@ -496,7 +496,7 @@ To configure access for `registry.example.com`, follow these steps: ...@@ -496,7 +496,7 @@ To configure access for `registry.example.com`, follow these steps:
bXlfdXNlcm5hbWU6bXlfcGFzc3dvcmQ= bXlfdXNlcm5hbWU6bXlfcGFzc3dvcmQ=
``` ```
1. Create a [secret variable] `DOCKER_AUTH_CONFIG` with the content of the 1. Create a [variable] `DOCKER_AUTH_CONFIG` with the content of the
Docker configuration file as the value: Docker configuration file as the value:
```json ```json
...@@ -632,7 +632,7 @@ creation. ...@@ -632,7 +632,7 @@ creation.
[postgres-hub]: https://hub.docker.com/r/_/postgres/ [postgres-hub]: https://hub.docker.com/r/_/postgres/
[mysql-hub]: https://hub.docker.com/r/_/mysql/ [mysql-hub]: https://hub.docker.com/r/_/mysql/
[runner-priv-reg]: http://docs.gitlab.com/runner/configuration/advanced-configuration.html#using-a-private-container-registry [runner-priv-reg]: http://docs.gitlab.com/runner/configuration/advanced-configuration.html#using-a-private-container-registry
[secret variable]: ../variables/README.md#secret-variables [variable]: ../variables/README.md#variables
[entrypoint]: https://docs.docker.com/engine/reference/builder/#entrypoint [entrypoint]: https://docs.docker.com/engine/reference/builder/#entrypoint
[cmd]: https://docs.docker.com/engine/reference/builder/#cmd [cmd]: https://docs.docker.com/engine/reference/builder/#cmd
[register]: https://docs.gitlab.com/runner/register/ [register]: https://docs.gitlab.com/runner/register/
...@@ -249,7 +249,7 @@ the basis of [Review apps](review_apps/index.md). ...@@ -249,7 +249,7 @@ the basis of [Review apps](review_apps/index.md).
NOTE: **Note:** NOTE: **Note:**
The `name` and `url` parameters can use most of the CI/CD variables, The `name` and `url` parameters can use most of the CI/CD variables,
including [predefined](variables/README.md#predefined-variables-environment-variables), including [predefined](variables/README.md#predefined-variables-environment-variables),
[secret](variables/README.md#secret-variables) and [project/group ones](variables/README.md#variables) and
[`.gitlab-ci.yml` variables](yaml/README.md#variables). You however cannot use variables [`.gitlab-ci.yml` variables](yaml/README.md#variables). You however cannot use variables
defined under `script` or on the Runner's side. There are also other variables that defined under `script` or on the Runner's side. There are also other variables that
are unsupported in the context of `environment:name`. You can read more about are unsupported in the context of `environment:name`. You can read more about
......
...@@ -58,7 +58,7 @@ The application is ready to use, but you need some additional steps to deploy it ...@@ -58,7 +58,7 @@ The application is ready to use, but you need some additional steps to deploy it
1. Log in to Artifactory with your user's credentials. 1. Log in to Artifactory with your user's credentials.
1. From the main screen, click on the `libs-release-local` item in the **Set Me Up** panel. 1. From the main screen, click on the `libs-release-local` item in the **Set Me Up** panel.
1. Copy to clipboard the configuration snippet under the **Deploy** paragraph. 1. Copy to clipboard the configuration snippet under the **Deploy** paragraph.
1. Change the `url` value in order to have it configurable via secret variables. 1. Change the `url` value in order to have it configurable via variables.
1. Copy the snippet in the `pom.xml` file for your project, just after the 1. Copy the snippet in the `pom.xml` file for your project, just after the
`dependencies` section. The snippet should look like this: `dependencies` section. The snippet should look like this:
...@@ -98,7 +98,7 @@ parameter in `.gitlab-ci.yml` to use the custom location instead of the default ...@@ -98,7 +98,7 @@ parameter in `.gitlab-ci.yml` to use the custom location instead of the default
</settings> </settings>
``` ```
Username and password will be replaced by the correct values using secret variables. Username and password will be replaced by the correct values using variables.
### Configure GitLab CI/CD for `simple-maven-dep` ### Configure GitLab CI/CD for `simple-maven-dep`
...@@ -107,8 +107,8 @@ Now it's time we set up [GitLab CI/CD](https://about.gitlab.com/features/gitlab- ...@@ -107,8 +107,8 @@ Now it's time we set up [GitLab CI/CD](https://about.gitlab.com/features/gitlab-
GitLab CI/CD uses a file in the root of the repo, named `.gitlab-ci.yml`, to read the definitions for jobs GitLab CI/CD uses a file in the root of the repo, named `.gitlab-ci.yml`, to read the definitions for jobs
that will be executed by the configured GitLab Runners. You can read more about this file in the [GitLab Documentation](https://docs.gitlab.com/ee/ci/yaml/). that will be executed by the configured GitLab Runners. You can read more about this file in the [GitLab Documentation](https://docs.gitlab.com/ee/ci/yaml/).
First of all, remember to set up secret variables for your deployment. Navigate to your project's **Settings > CI/CD** page First of all, remember to set up variables for your deployment. Navigate to your project's **Settings > CI/CD > Variables** page
and add the following secret variables (replace them with your current values, of course): and add the following ones (replace them with your current values, of course):
- **MAVEN_REPO_URL**: `http://artifactory.example.com:8081/artifactory` (your Artifactory URL) - **MAVEN_REPO_URL**: `http://artifactory.example.com:8081/artifactory` (your Artifactory URL)
- **MAVEN_REPO_USER**: `gitlab` (your Artifactory username) - **MAVEN_REPO_USER**: `gitlab` (your Artifactory username)
...@@ -156,7 +156,7 @@ by running all Maven phases in a sequential order, therefore, executing `mvn tes ...@@ -156,7 +156,7 @@ by running all Maven phases in a sequential order, therefore, executing `mvn tes
Both `build` and `test` jobs leverage the `mvn` command to compile the application and to test it as defined in the test suite that is part of the application. Both `build` and `test` jobs leverage the `mvn` command to compile the application and to test it as defined in the test suite that is part of the application.
Deploy to Artifactory is done as defined by the secret variables we have just set up. Deploy to Artifactory is done as defined by the variables we have just set up.
The deployment occurs only if we're pushing or merging to `master` branch, so that the development versions are tested but not published. The deployment occurs only if we're pushing or merging to `master` branch, so that the development versions are tested but not published.
Done! Now you have all the changes in the GitLab repo, and a pipeline has already been started for this commit. In the **Pipelines** tab you can see what's happening. Done! Now you have all the changes in the GitLab repo, and a pipeline has already been started for this commit. In the **Pipelines** tab you can see what's happening.
......
...@@ -111,7 +111,7 @@ We also use two secure variables: ...@@ -111,7 +111,7 @@ We also use two secure variables:
## Storing API keys ## Storing API keys
Secure Variables can added by going to your project's Secure Variables can added by going to your project's
**Settings ➔ CI / CD ➔ Secret variables**. The variables that are defined **Settings ➔ CI / CD ➔ Variables**. The variables that are defined
in the project settings are sent along with the build script to the Runner. in the project settings are sent along with the build script to the Runner.
The secure variables are stored out of the repository. Never store secrets in The secure variables are stored out of the repository. Never store secrets in
your project's `.gitlab-ci.yml`. It is also important that the secret's value your project's `.gitlab-ci.yml`. It is also important that the secret's value
......
...@@ -406,7 +406,7 @@ and further delves into the principles of GitLab CI/CD than discussed in this ar ...@@ -406,7 +406,7 @@ and further delves into the principles of GitLab CI/CD than discussed in this ar
We need to be able to deploy to AWS with our AWS account credentials, but we certainly We need to be able to deploy to AWS with our AWS account credentials, but we certainly
don't want to put secrets into source code. Luckily GitLab provides a solution for this don't want to put secrets into source code. Luckily GitLab provides a solution for this
with [Secret Variables](../../../ci/variables/README.md). This can get complicated with [Variables](../../../ci/variables/README.md). This can get complicated
due to [IAM](https://aws.amazon.com/iam/) management. As a best practice, you shouldn't due to [IAM](https://aws.amazon.com/iam/) management. As a best practice, you shouldn't
use root security credentials. Proper IAM credential management is beyond the scope of this use root security credentials. Proper IAM credential management is beyond the scope of this
article, but AWS will remind you that using root credentials is unadvised and against their article, but AWS will remind you that using root credentials is unadvised and against their
...@@ -428,7 +428,7 @@ fully understand [IAM Best Practices in AWS](http://docs.aws.amazon.com/IAM/late ...@@ -428,7 +428,7 @@ fully understand [IAM Best Practices in AWS](http://docs.aws.amazon.com/IAM/late
To deploy our build artifacts, we need to install the [AWS CLI](https://aws.amazon.com/cli/) on To deploy our build artifacts, we need to install the [AWS CLI](https://aws.amazon.com/cli/) on
the Shared Runner. The Shared Runner also needs to be able to authenticate with your AWS the Shared Runner. The Shared Runner also needs to be able to authenticate with your AWS
account to deploy the artifacts. By convention, AWS CLI will look for `AWS_ACCESS_KEY_ID` account to deploy the artifacts. By convention, AWS CLI will look for `AWS_ACCESS_KEY_ID`
and `AWS_SECRET_ACCESS_KEY`. GitLab's CI gives us a way to pass the secret variables we and `AWS_SECRET_ACCESS_KEY`. GitLab's CI gives us a way to pass the variables we
set up in the prior section using the `variables` portion of the `deploy` job. At the end, set up in the prior section using the `variables` portion of the `deploy` job. At the end,
we add directives to ensure deployment `only` happens on pushes to `master`. This way, every we add directives to ensure deployment `only` happens on pushes to `master`. This way, every
single branch still runs through CI, and only merging (or committing directly) to master will single branch still runs through CI, and only merging (or committing directly) to master will
......
...@@ -116,11 +116,11 @@ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys ...@@ -116,11 +116,11 @@ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_rsa cat ~/.ssh/id_rsa
``` ```
Now, let's add it to your GitLab project as a [secret variable](../../variables/README.md#secret-variables). Now, let's add it to your GitLab project as a [variable](../../variables/README.md#variables).
Secret variables are user-defined variables and are stored out of `.gitlab-ci.yml`, for security purposes. Variables are user-defined variables and are stored out of `.gitlab-ci.yml`, for security purposes.
They can be added per project by navigating to the project's **Settings** > **CI/CD**. They can be added per project by navigating to the project's **Settings** > **CI/CD**.
![secret variables page](img/secret_variables_page.png) ![variables page](img/secret_variables_page.png)
To the field **KEY**, add the name `SSH_PRIVATE_KEY`, and to the **VALUE** field, paste the private key you've copied earlier. To the field **KEY**, add the name `SSH_PRIVATE_KEY`, and to the **VALUE** field, paste the private key you've copied earlier.
We'll use this variable in the `.gitlab-ci.yml` later, to easily connect to our remote server as the deployer user without entering its password. We'll use this variable in the `.gitlab-ci.yml` later, to easily connect to our remote server as the deployer user without entering its password.
......
...@@ -258,7 +258,7 @@ on that specific branch: ...@@ -258,7 +258,7 @@ on that specific branch:
- trigger **manual actions** on existing pipelines - trigger **manual actions** on existing pipelines
- **retry/cancel** existing jobs (using Web UI or Pipelines API) - **retry/cancel** existing jobs (using Web UI or Pipelines API)
**Secret variables** marked as **protected** are accessible only to jobs that **Variables** marked as **protected** are accessible only to jobs that
run on protected branches, avoiding untrusted users to get unintended access to run on protected branches, avoiding untrusted users to get unintended access to
sensitive information like deployment credentials and tokens. sensitive information like deployment credentials and tokens.
......
...@@ -25,7 +25,7 @@ with any type of [executor](https://docs.gitlab.com/runner/executors/) ...@@ -25,7 +25,7 @@ with any type of [executor](https://docs.gitlab.com/runner/executors/)
## How it works ## How it works
1. Create a new SSH key pair locally with [ssh-keygen](http://linux.die.net/man/1/ssh-keygen) 1. Create a new SSH key pair locally with [ssh-keygen](http://linux.die.net/man/1/ssh-keygen)
1. Add the private key as a [secret variable](../variables/README.md) to 1. Add the private key as a [variable](../variables/README.md) to
your project your project
1. Run the [ssh-agent](http://linux.die.net/man/1/ssh-agent) during job to load 1. Run the [ssh-agent](http://linux.die.net/man/1/ssh-agent) during job to load
the private key. the private key.
...@@ -49,7 +49,7 @@ to access it. This is where an SSH key pair comes in handy. ...@@ -49,7 +49,7 @@ to access it. This is where an SSH key pair comes in handy.
**Do not** add a passphrase to the SSH key, or the `before_script` will\ **Do not** add a passphrase to the SSH key, or the `before_script` will\
prompt for it. prompt for it.
1. Create a new [secret variable](../variables/README.md#secret-variables). 1. Create a new [variable](../variables/README.md#variables).
As **Key** enter the name `SSH_PRIVATE_KEY` and in the **Value** field paste As **Key** enter the name `SSH_PRIVATE_KEY` and in the **Value** field paste
the content of your _private_ key that you created earlier. the content of your _private_ key that you created earlier.
...@@ -157,7 +157,7 @@ ssh-keyscan example.com ...@@ -157,7 +157,7 @@ ssh-keyscan example.com
ssh-keyscan 1.2.3.4 ssh-keyscan 1.2.3.4
``` ```
Create a new [secret variable](../variables/README.md#secret-variables) with Create a new [variable](../variables/README.md#variables) with
`SSH_KNOWN_HOSTS` as "Key", and as a "Value" add the output of `ssh-keyscan`. `SSH_KNOWN_HOSTS` as "Key", and as a "Value" add the output of `ssh-keyscan`.
NOTE: **Note:** NOTE: **Note:**
...@@ -165,7 +165,7 @@ If you need to connect to multiple servers, all the server host keys ...@@ -165,7 +165,7 @@ If you need to connect to multiple servers, all the server host keys
need to be collected in the **Value** of the variable, one key per line. need to be collected in the **Value** of the variable, one key per line.
TIP: **Tip:** TIP: **Tip:**
By using a secret variable instead of `ssh-keyscan` directly inside By using a variable instead of `ssh-keyscan` directly inside
`.gitlab-ci.yml`, it has the benefit that you don't have to change `.gitlab-ci.yml` `.gitlab-ci.yml`, it has the benefit that you don't have to change `.gitlab-ci.yml`
if the host domain name changes for some reason. Also, the values are predefined if the host domain name changes for some reason. Also, the values are predefined
by you, meaning that if the host keys suddenly change, the CI/CD job will fail, by you, meaning that if the host keys suddenly change, the CI/CD job will fail,
......
...@@ -53,7 +53,7 @@ The action is irreversible. ...@@ -53,7 +53,7 @@ The action is irreversible.
it will not trigger a job. it will not trigger a job.
- If your project is public, passing the token in plain text is probably not the - If your project is public, passing the token in plain text is probably not the
wisest idea, so you might want to use a wisest idea, so you might want to use a
[secret variable](../variables/README.md#secret-variables) for that purpose. [variable](../variables/README.md#variables) for that purpose.
To trigger a job you need to send a `POST` request to GitLab's API endpoint: To trigger a job you need to send a `POST` request to GitLab's API endpoint:
......
...@@ -10,17 +10,17 @@ The variables can be overwritten and they take precedence over each other in ...@@ -10,17 +10,17 @@ The variables can be overwritten and they take precedence over each other in
this order: this order:
1. [Trigger variables][triggers] or [scheduled pipeline variables](../../user/project/pipelines/schedules.md#making-use-of-scheduled-pipeline-variables) (take precedence over all) 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 [secret variables](#secret-variables) or [protected secret variables](#protected-secret-variables) 1. Project-level [variables](#variables) or [protected variables](#protected-variables)
1. Group-level [secret variables](#secret-variables) or [protected secret variables](#protected-secret-variables) 1. Group-level [variables](#variables) or [protected variables](#protected-variables)
1. YAML-defined [job-level variables](../yaml/README.md#variables) 1. YAML-defined [job-level variables](../yaml/README.md#variables)
1. YAML-defined [global variables](../yaml/README.md#variables) 1. YAML-defined [global variables](../yaml/README.md#variables)
1. [Deployment variables](#deployment-variables) 1. [Deployment variables](#deployment-variables)
1. [Predefined variables](#predefined-variables-environment-variables) (are the 1. [Predefined variables](#predefined-variables-environment-variables) (are the
lowest in the chain) lowest in the chain)
For example, if you define `API_TOKEN=secure` as a secret variable and 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 `API_TOKEN=yaml` in your `.gitlab-ci.yml`, the `API_TOKEN` will take the value
`secure` as the secret variables are higher in the chain. `secure` as the project variables are higher in the chain.
## Unsupported variables ## Unsupported variables
...@@ -165,49 +165,49 @@ script: ...@@ -165,49 +165,49 @@ script:
- 'eval $LS_CMD' # will execute 'ls -al $TMP_DIR' - 'eval $LS_CMD' # will execute 'ls -al $TMP_DIR'
``` ```
## Secret variables ## Variables
NOTE: **Note:** NOTE: **Note:**
Group-level secret variables were added in GitLab 9.4. Group-level variables were added in GitLab 9.4.
CAUTION: **Important:** CAUTION: **Important:**
Be aware that secret variables are not masked, and their values can be shown Be aware that variables are not masked, and their values can be shown
in the job logs if explicitly asked to do so. If your project is public or in the job logs if explicitly asked to do so. If your project is public or
internal, you can set the pipelines private from your [project's Pipelines internal, you can set the pipelines private from your [project's Pipelines
settings](../../user/project/pipelines/settings.md#visibility-of-pipelines). settings](../../user/project/pipelines/settings.md#visibility-of-pipelines).
Follow the discussion in issue [#13784][ce-13784] for masking the secret variables. Follow the discussion in issue [#13784][ce-13784] for masking the variables.
GitLab CI allows you to define per-project or per-group secret variables GitLab CI allows you to define per-project or per-group variables
that are set in the pipeline environment. The secret variables are stored out of 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 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 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 secret variables can be added by going to your project's Project-level variables can be added by going to your project's
**Settings > CI/CD**, then finding the section called **Secret variables**. **Settings > CI/CD**, then finding the section called **Variables**.
Likewise, group-level secret variables can be added by going to your group's Likewise, group-level variables can be added by going to your group's
**Settings > CI/CD**, then finding the section called **Secret variables**. **Settings > CI/CD**, then finding the section called **Variables**.
Any variables of [subgroups] will be inherited recursively. Any variables of [subgroups] will be inherited recursively.
![Secret variables](img/secret_variables.png) ![Variables](img/secret_variables.png)
Once you set them, they will be available for all subsequent pipelines. You can also Once you set them, they will be available for all subsequent pipelines. You can also
[protect your variables](#protected-secret-variables). [protect your variables](#protected-variables).
### Protected secret variables ### Protected variables
>**Notes:** >**Notes:**
This feature requires GitLab 9.3 or higher. This feature requires GitLab 9.3 or higher.
Secret variables could be protected. Whenever a secret variable is Variables could be protected. Whenever a variable is
protected, it would only be securely passed to pipelines running on the protected, it would only be securely passed to pipelines running on the
[protected branches] or [protected tags]. The other pipelines would not get any [protected branches] or [protected tags]. The other pipelines would not get any
protected variables. protected variables.
Protected variables can be added by going to your project's Protected variables can be added by going to your project's
**Settings > CI/CD**, then finding the section called **Settings > CI/CD**, then finding the section called
**Secret variables**, and check "Protected". **Variables**, and check "Protected".
Once you set them, they will be available for all subsequent pipelines. Once you set them, they will be available for all subsequent pipelines.
...@@ -231,7 +231,7 @@ An example project service that defines deployment variables is the ...@@ -231,7 +231,7 @@ An example project service that defines deployment variables is the
CAUTION: **Warning:** CAUTION: **Warning:**
Enabling debug tracing can have severe security implications. The Enabling debug tracing can have severe security implications. The
output **will** contain the content of all your secret variables and any other output **will** contain the content of all your variables and any other
secrets! The output **will** be uploaded to the GitLab server and made visible secrets! The output **will** be uploaded to the GitLab server and made visible
in job traces! in job traces!
...@@ -419,7 +419,7 @@ job_name: ...@@ -419,7 +419,7 @@ job_name:
``` ```
You can also list all environment variables with the `export` command, You can also list all environment variables with the `export` command,
but be aware that this will also expose the values of all the secret variables but be aware that this will also expose the values of all the variables
you set, in the job log: you set, in the job log:
```yaml ```yaml
...@@ -472,7 +472,7 @@ It is possible to use variables expressions with only / except policies in ...@@ -472,7 +472,7 @@ It is possible to use variables expressions with only / except policies in
`.gitlab-ci.yml`. By using this approach you can limit what jobs are going to `.gitlab-ci.yml`. By using this approach you can limit what jobs are going to
be created within a pipeline after pushing a code to GitLab. be created within a pipeline after pushing a code to GitLab.
This is particularly useful in combination with secret variables and triggered This is particularly useful in combination with variables and triggered
pipeline variables. pipeline variables.
```yaml ```yaml
...@@ -550,7 +550,7 @@ Below you can find supported syntax reference: ...@@ -550,7 +550,7 @@ Below you can find supported syntax reference:
Pattern matching is case-sensitive by default. Use `i` flag modifier, like Pattern matching is case-sensitive by default. Use `i` flag modifier, like
`/pattern/i` to make a pattern case-insensitive. `/pattern/i` to make a pattern case-insensitive.
[ce-13784]: https://gitlab.com/gitlab-org/gitlab-ce/issues/13784 "Simple protection of CI secret variables" [ce-13784]: https://gitlab.com/gitlab-org/gitlab-ce/issues/13784 "Simple protection of CI variables"
[eep]: https://about.gitlab.com/products/ "Available only in GitLab Premium" [eep]: https://about.gitlab.com/products/ "Available only in GitLab Premium"
[envs]: ../environments.md [envs]: ../environments.md
[protected branches]: ../../user/project/protected_branches.md [protected branches]: ../../user/project/protected_branches.md
......
...@@ -17,7 +17,7 @@ There are basically two places where you can use any defined variables: ...@@ -17,7 +17,7 @@ There are basically two places where you can use any defined variables:
| Definition | Can be expanded? | Expansion place | Description | | Definition | Can be expanded? | Expansion place | Description |
|--------------------------------------|-------------------|-----------------|--------------| |--------------------------------------|-------------------|-----------------|--------------|
| `environment:url` | yes | GitLab | The variable expansion is made by GitLab's [internal variable expansion mechanism](#gitlab-internal-variable-expansion-mechanism).<ul><li>**Supported:** all variables defined for a job (secret variables, variables from `.gitlab-ci.yml`, variables from triggers, variables from pipeline schedules)</li><li>**Not suported:** variables defined in Runner's `config.toml` and variables created in job's `script`</li></ul> | | `environment:url` | yes | GitLab | The variable expansion is made by GitLab's [internal variable expansion mechanism](#gitlab-internal-variable-expansion-mechanism).<ul><li>**Supported:** all variables defined for a job (project/group variables, variables from `.gitlab-ci.yml`, variables from triggers, variables from pipeline schedules)</li><li>**Not suported:** variables defined in Runner's `config.toml` and variables created in job's `script`</li></ul> |
| `environment:name` | yes | GitLab | Similar to `environment:url`, but the variables expansion **doesn't support**: <ul><li>variables that are based on the environment's name (`CI_ENVIRONMENT_NAME`, `CI_ENVIRONMENT_SLUG`)</li><li>any other variables related to environment (currently only `CI_ENVIRONMENT_URL`)</li><li>[persisted variables](#persisted-variables)</li></ul> | | `environment:name` | yes | GitLab | Similar to `environment:url`, but the variables expansion **doesn't support**: <ul><li>variables that are based on the environment's name (`CI_ENVIRONMENT_NAME`, `CI_ENVIRONMENT_SLUG`)</li><li>any other variables related to environment (currently only `CI_ENVIRONMENT_URL`)</li><li>[persisted variables](#persisted-variables)</li></ul> |
| `variables` | yes | Runner | The variable expansion is made by GitLab Runner's [internal variable expansion mechanism](#gitlab-runner-internal-variable-expansion-mechanism) | | `variables` | yes | Runner | The variable expansion is made by GitLab Runner's [internal variable expansion mechanism](#gitlab-runner-internal-variable-expansion-mechanism) |
| `image` | yes | Runner | The variable expansion is made by GitLab Runner's [internal variable expansion mechanism](#gitlab-runner-internal-variable-expansion-mechanism) | | `image` | yes | Runner | The variable expansion is made by GitLab Runner's [internal variable expansion mechanism](#gitlab-runner-internal-variable-expansion-mechanism) |
...@@ -55,7 +55,7 @@ since the expansion is done in GitLab before any Runner will get the job. ...@@ -55,7 +55,7 @@ since the expansion is done in GitLab before any Runner will get the job.
### GitLab Runner internal variable expansion mechanism ### GitLab Runner internal variable expansion mechanism
- **Supported:** secret variables, `.gitlab-ci.yml` variables, `config.toml` variables, and - **Supported:** project/group variables, `.gitlab-ci.yml` variables, `config.toml` variables, and
variables from triggers and pipeline schedules variables from triggers and pipeline schedules
- **Not supported:** variables defined inside of scripts (e.g., `export MY_VARIABLE="test"`) - **Not supported:** variables defined inside of scripts (e.g., `export MY_VARIABLE="test"`)
...@@ -76,7 +76,7 @@ are using a different variables syntax. ...@@ -76,7 +76,7 @@ are using a different variables syntax.
**Supported:** **Supported:**
- The `script` may use all available variables that are default for the shell (e.g., `$PATH` which - The `script` may use all available variables that are default for the shell (e.g., `$PATH` which
should be present in all bash/sh shells) and all variables defined by GitLab CI/CD (secret variables, should be present in all bash/sh shells) and all variables defined by GitLab CI/CD (project/group variables,
`.gitlab-ci.yml` variables, `config.toml` variables, and variables from triggers and pipeline schedules). `.gitlab-ci.yml` variables, `config.toml` variables, and variables from triggers and pipeline schedules).
- The `script` may also use all variables defined in the lines before. So, for example, if you define - The `script` may also use all variables defined in the lines before. So, for example, if you define
a variable `export MY_VARIABLE="test"`: a variable `export MY_VARIABLE="test"`:
......
...@@ -327,7 +327,7 @@ Refs strategy equals to simplified only/except configuration, whereas ...@@ -327,7 +327,7 @@ Refs strategy equals to simplified only/except configuration, whereas
kubernetes strategy accepts only `active` keyword. kubernetes strategy accepts only `active` keyword.
`variables` keyword is used to define variables expressions. In other words `variables` keyword is used to define variables expressions. In other words
you can use predefined variables / secret variables / project / group or you can use predefined variables / project / group or
environment-scoped variables to define an expression GitLab is going to environment-scoped variables to define an expression GitLab is going to
evaluate in order to decide whether a job should be created or not. evaluate in order to decide whether a job should be created or not.
...@@ -1249,7 +1249,7 @@ Runner itself](../variables/README.md#predefined-variables-environment-variables ...@@ -1249,7 +1249,7 @@ Runner itself](../variables/README.md#predefined-variables-environment-variables
One example would be `CI_COMMIT_REF_NAME` which has the value of One example would be `CI_COMMIT_REF_NAME` which has the value of
the branch or tag name for which project is built. Apart from the variables the branch or tag name for which project is built. Apart from the variables
you can set in `.gitlab-ci.yml`, there are also the so called you can set in `.gitlab-ci.yml`, there are also the so called
[secret variables](../variables/README.md#secret-variables) [Variables](../variables/README.md#variables)
which can be set in GitLab's UI. which can be set in GitLab's UI.
[Learn more about variables and their priority.][variables] [Learn more about variables and their priority.][variables]
......
...@@ -349,7 +349,7 @@ In this case: ...@@ -349,7 +349,7 @@ In this case:
### Fake tokens ### Fake tokens
There may be times where a token is needed to demonstrate an API call using There may be times where a token is needed to demonstrate an API call using
cURL or a secret variable used in CI. It is strongly advised not to use real cURL or a variable used in CI. It is strongly advised not to use real
tokens in documentation even if the probability of a token being exploited is tokens in documentation even if the probability of a token being exploited is
low. low.
......
...@@ -57,7 +57,7 @@ $ sudo gitlab-rails runner "Service.where(type: ['JenkinsService', 'JenkinsDepre ...@@ -57,7 +57,7 @@ $ sudo gitlab-rails runner "Service.where(type: ['JenkinsService', 'JenkinsDepre
$ bundle exec rails runner "Service.where(type: ['JenkinsService', 'JenkinsDeprecatedService', 'GithubService']).delete_all" production $ bundle exec rails runner "Service.where(type: ['JenkinsService', 'JenkinsDeprecatedService', 'GithubService']).delete_all" production
``` ```
### Secret variables environment scopes ### Variables environment scopes
If you're using this feature and there are variables sharing the same If you're using this feature and there are variables sharing the same
key, but they have different scopes in a project, then you might want to key, but they have different scopes in a project, then you might want to
......
...@@ -492,8 +492,8 @@ directory (repositories, uploads). ...@@ -492,8 +492,8 @@ directory (repositories, uploads).
To restore a backup, you will also need to restore `/etc/gitlab/gitlab-secrets.json` To restore a backup, you will also need to restore `/etc/gitlab/gitlab-secrets.json`
(for Omnibus packages) or `/home/git/gitlab/.secret` (for installations (for Omnibus packages) or `/home/git/gitlab/.secret` (for installations
from source). This file contains the database encryption key, from source). This file contains the database encryption key,
[CI secret variables](../ci/variables/README.md#secret-variables), and [CI/CD variables](../ci/variables/README.md#variables), and
secret variables used for [two-factor authentication](../user/profile/account/two_factor_authentication.md). variables used for [two-factor authentication](../user/profile/account/two_factor_authentication.md).
If you fail to restore this encryption key file along with the application data If you fail to restore this encryption key file along with the application data
backup, users with two-factor authentication enabled and GitLab Runners will backup, users with two-factor authentication enabled and GitLab Runners will
lose access to your GitLab server. lose access to your GitLab server.
......
...@@ -437,7 +437,7 @@ repo or by specifying a project variable: ...@@ -437,7 +437,7 @@ repo or by specifying a project variable:
file in it, Auto DevOps will detect the chart and use it instead of the [default file in it, Auto DevOps will detect the chart and use it instead of the [default
one](https://gitlab.com/charts/charts.gitlab.io/tree/master/charts/auto-deploy-app). one](https://gitlab.com/charts/charts.gitlab.io/tree/master/charts/auto-deploy-app).
This can be a great way to control exactly how your application is deployed. This can be a great way to control exactly how your application is deployed.
- **Project variable** - Create a [project variable](../../ci/variables/README.md#secret-variables) - **Project variable** - Create a [variable](../../ci/variables/README.md#variables)
`AUTO_DEVOPS_CHART` with the URL of a custom chart to use. `AUTO_DEVOPS_CHART` with the URL of a custom chart to use.
### Customizing `.gitlab-ci.yml` ### Customizing `.gitlab-ci.yml`
...@@ -507,7 +507,7 @@ also be customized, and you can easily use a [custom buildpack](#custom-buildpac ...@@ -507,7 +507,7 @@ also be customized, and you can easily use a [custom buildpack](#custom-buildpac
TIP: **Tip:** TIP: **Tip:**
Set up the replica variables using a Set up the replica variables using a
[project variable](../../ci/variables/README.md#secret-variables) [project variable](../../ci/variables/README.md#variables)
and scale your application by just redeploying it! and scale your application by just redeploying it!
CAUTION: **Caution:** CAUTION: **Caution:**
...@@ -582,7 +582,7 @@ staging environment and deploy to production manually. For this scenario, the ...@@ -582,7 +582,7 @@ staging environment and deploy to production manually. For this scenario, the
`STAGING_ENABLED` environment variable was introduced. `STAGING_ENABLED` environment variable was introduced.
If `STAGING_ENABLED` is defined in your project (e.g., set `STAGING_ENABLED` to If `STAGING_ENABLED` is defined in your project (e.g., set `STAGING_ENABLED` to
`1` as a secret variable), then the application will be automatically deployed `1` as a variable), then the application will be automatically deployed
to a `staging` environment, and a `production_manual` job will be created for to a `staging` environment, and a `production_manual` job will be created for
you when you're ready to manually deploy to production. you when you're ready to manually deploy to production.
...@@ -595,7 +595,7 @@ A [canary environment](https://docs.gitlab.com/ee/user/project/canary_deployment ...@@ -595,7 +595,7 @@ A [canary environment](https://docs.gitlab.com/ee/user/project/canary_deployment
before any changes are deployed to production. before any changes are deployed to production.
If `CANARY_ENABLED` is defined in your project (e.g., set `CANARY_ENABLED` to If `CANARY_ENABLED` is defined in your project (e.g., set `CANARY_ENABLED` to
`1` as a secret variable) then two manual jobs will be created: `1` as a variable) then two manual jobs will be created:
- `canary` which will deploy the application to the canary environment - `canary` which will deploy the application to the canary environment
- `production_manual` which is to be used by you when you're ready to manually - `production_manual` which is to be used by you when you're ready to manually
...@@ -611,7 +611,7 @@ This will allow you to first check how the app is behaving, and later manually ...@@ -611,7 +611,7 @@ This will allow you to first check how the app is behaving, and later manually
increasing the rollout up to 100%. increasing the rollout up to 100%.
If `INCREMENTAL_ROLLOUT_ENABLED` is defined in your project (e.g., set If `INCREMENTAL_ROLLOUT_ENABLED` is defined in your project (e.g., set
`INCREMENTAL_ROLLOUT_ENABLED` to `1` as a secret variable), then instead of the `INCREMENTAL_ROLLOUT_ENABLED` to `1` as a variable), then instead of the
standard `production` job, 4 different standard `production` job, 4 different
[manual jobs](../../ci/pipelines.md#manual-actions-from-the-pipeline-graph) [manual jobs](../../ci/pipelines.md#manual-actions-from-the-pipeline-graph)
will be created: will be created:
......
...@@ -233,7 +233,7 @@ When adding more than one Kubernetes clusters to your project, you need to ...@@ -233,7 +233,7 @@ When adding more than one Kubernetes clusters to your project, you need to
differentiate them with an environment scope. The environment scope associates differentiate them with an environment scope. The environment scope associates
clusters and [environments](../../../ci/environments.md) in an 1:1 relationship clusters and [environments](../../../ci/environments.md) in an 1:1 relationship
similar to how the similar to how the
[environment-specific variables](../../../ci/variables/README.md#limiting-environment-scopes-of-secret-variables) [environment-specific variables](../../../ci/variables/README.md#limiting-environment-scopes-of-variables)
work. work.
The default environment scope is `*`, which means all jobs, regardless of their The default environment scope is `*`, which means all jobs, regardless of their
......
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