blob: 2b8cf7bab445051ea3c92e9ffc09f24e9275a682 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#
# Variables can be used to for more dynamic behavior in jobs and scripts.
# For more information, see https://docs.gitlab.com/ee/ci/variables/README.html
#
stages:
- test
variables:
VAR1: "Variable 1 defined globally"
use-a-variable:
stage: test
script:
- echo "You can use variables in jobs."
- echo "The content of 'VAR1' is = $VAR1"
override-a-variable:
stage: test
variables:
VAR1: "Variable 1 was overriden in in the job."
script:
- echo "You can override global variables in jobs."
- echo "The content of 'VAR1' is = $VAR1"
define-a-new-variable:
stage: test
variables:
VAR2: "Variable 2 is new and defined in the job only."
script:
- echo "You can mix global variables with variables defined in jobs."
- echo "The content of 'VAR1' is = $VAR1"
- echo "The content of 'VAR2' is = $VAR2"
incorrect-variable-usage:
stage: test
script:
- echo "You can't use variables only defined in other jobs."
- echo "The content of 'VAR2' is = $VAR2"
predefined-variables:
stage: test
script:
- echo "Some variables are predefined by GitLab CI/CD, for example:"
- echo "The commit author's username is $GITLAB_USER_LOGIN"
- echo "The commit branch is $CI_COMMIT_BRANCH"
- echo "The project path is $CI_PROJECT_PATH"
|