Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
89e3bea7
Commit
89e3bea7
authored
Oct 06, 2020
by
Suzanne Selhorn
Committed by
Marcel Amirault
Oct 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docs: Edited variables content in CI YAML file
parent
6fcb0e5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
19 deletions
+25
-19
doc/ci/yaml/README.md
doc/ci/yaml/README.md
+25
-19
No files found.
doc/ci/yaml/README.md
View file @
89e3bea7
...
@@ -4132,34 +4132,40 @@ Read more on [GitLab Pages user documentation](../../user/project/pages/index.md
...
@@ -4132,34 +4132,40 @@ Read more on [GitLab Pages user documentation](../../user/project/pages/index.md
> Introduced in GitLab Runner v0.5.0.
> Introduced in GitLab Runner v0.5.0.
NOTE:
**Note:**
Variables are configurable values that are passed to jobs. They can be set
Integers (as well as strings) are legal both for variable's name and value.
globally and per-job.
Floats are not legal and can't be used.
There are two types of variables.
-
[
Custom variables
](
../variables/README.md#gitlab-cicd-environment-variables
)
:
You can define their values in the
`.gitlab-ci.yml`
file, in the GitLab UI,
or by using the API.
-
[
Predefined variables
](
../variables/README.md#custom-environment-variables
)
:
These values are set by the runner itself.
One example is
`CI_COMMIT_REF_NAME`
, which is the branch or tag the project is built for.
Variables are configurable values in
`.gitlab-ci.yml`
that are passed to jobs.
After you define a variable, you can use it in all executed commands and scripts.
They can be set globally and per-job.
When you use the
`variables`
keyword in jobs, it overrides the global
YAML variables and predefined ones of the same name.
Variables are stored in the Git repository and are meant for non-sensitive
Variables are meant for non-sensitive project configuration, for example:
project configuration, for example:
```
yaml
```
yaml
variables
:
variables
:
DATABASE_URL
:
"
postgres://postgres@postgres/my_database"
DATABASE_URL
:
"
postgres://postgres@postgres/my_database"
```
```
You can use these variables later in all executed commands and scripts.
You can use integers and strings for the variable's name and value.
The YAML-defined variables are also set to all created service containers,
You cannot use floats.
so that you can fine tune them.
If you define a variable at the top level of the
`gitlab-ci.yml`
file, it is global,
meaning it applies to all jobs.
If you define a variable within a job, it's available to that job only.
If a variable of the same name is defined globally and for a specific job, the
[
job-specific variable is used
](
../variables/README.md#priority-of-environment-variables
)
.
Except for the user-defined variables, there are also variables
[
set up by the
All YAML-defined variables are also set to any linked
runner itself
](
../variables/README.md#predefined-environment-variables
)
.
[
service containers
](
../docker/using_docker_images.md#what-is-a-service
)
.
One example would be
`CI_COMMIT_REF_NAME`
, which has the value of
the branch or tag name the project is built for. Apart from the variables
you can set in
`.gitlab-ci.yml`
, there are also environment
[
variables
](
../variables/README.md#gitlab-cicd-environment-variables
)
,
which can be set in the GitLab UI.
[
YAML anchors for variables
](
#yaml-anchors-for-variables
)
are available.
[
YAML anchors for variables
](
#yaml-anchors-for-variables
)
are available.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment