summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-04-18 09:46:12 -0400
committerKamil Trzcinski <ayufan@ayufan.eu>2016-04-18 09:46:12 -0400
commitaca1e14bd39893be176222ccdb6e9d85799098e9 (patch)
tree5863779cc39d2394a7fa6bf51484e59e8fb1366f /doc
parent39c2677e862b3165a203239ce7fd829d5586392a (diff)
parent5ae4fd2181e81f6e75a9d4021fc7d0c4749139ef (diff)
downloadgitlab-ce-aca1e14bd39893be176222ccdb6e9d85799098e9.tar.gz
Merge remote-tracking branch 'origin/master' into after-script
Diffstat (limited to 'doc')
-rw-r--r--doc/ci/variables/README.md22
-rw-r--r--doc/ci/yaml/README.md16
2 files changed, 31 insertions, 7 deletions
diff --git a/doc/ci/variables/README.md b/doc/ci/variables/README.md
index b0e53cbc261..70fb81492d6 100644
--- a/doc/ci/variables/README.md
+++ b/doc/ci/variables/README.md
@@ -1,17 +1,20 @@
## Variables
+
When receiving a build 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**
The variables can be overwritten. They take precedence over each other in this order:
+1. Trigger variables
1. Secure variables
-1. YAML-defined variables
+1. YAML-defined job-level variables
+1. YAML-defined global variables
1. Predefined variables
For example, if you define:
-1. API_TOKEN=SECURE as Secure Variable
-1. API_TOKEN=YAML as YAML-defined variable
+1. `API_TOKEN=SECURE` as Secure Variable
+1. `API_TOKEN=YAML` as YAML-defined variable
-The API_TOKEN will take the Secure Variable value: `SECURE`.
+The `API_TOKEN` will take the Secure Variable value: `SECURE`.
### Predefined variables (Environment Variables)
@@ -70,15 +73,20 @@ These variables can be later used in all executed commands and scripts.
The YAML-defined variables are also set to all created service containers, thus allowing to fine tune them.
+Variables can be defined at a global level, but also at a job level.
+
More information about Docker integration can be found in [Using Docker Images](../docker/using_docker_images.md).
### User-defined variables (Secure Variables)
**This feature requires GitLab Runner 0.4.0 or higher**
-GitLab CI allows you to define per-project **Secure Variables** that are set in build environment.
+GitLab CI allows you to define per-project **Secure Variables** that are set in
+the build environment.
The secure variables are stored out of the repository (the `.gitlab-ci.yml`).
-The variables are securely passed to GitLab Runner and are available in build environment.
-It's desired method to use them for storing passwords, secret keys or whatever you want.
+The variables are securely passed to GitLab Runner and are available in the
+build environment.
+It's desired method to use them for storing passwords, secret keys or whatever
+you want.
**The value of the variable can be shown in build log if explicitly asked to do so.**
If your project is public or internal you can make the builds private.
diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md
index 697445bceea..bd3ec9e4688 100644
--- a/doc/ci/yaml/README.md
+++ b/doc/ci/yaml/README.md
@@ -24,6 +24,7 @@ If you want a quick introduction to GitLab CI, follow our
- [Jobs](#jobs)
- [script](#script)
- [stage](#stage)
+ - [job variables](#job-variables)
- [only and except](#only-and-except)
- [tags](#tags)
- [when](#when)
@@ -187,6 +188,8 @@ These variables can be later used in all executed commands and scripts.
The YAML-defined variables are also set to all created service containers,
thus allowing to fine tune them.
+Variables can be also defined on [job level](#job-variables).
+
### cache
>**Note:**
@@ -337,6 +340,7 @@ job_name:
| services | no | Use docker services, covered in [Using Docker Images](../docker/using_docker_images.md#define-image-and-services-from-gitlab-ciyml) |
| stage | no | Defines a build stage (default: `test`) |
| type | no | Alias for `stage` |
+| variables | no | Define build variables on a job level |
| only | no | Defines a list of git refs for which build is created |
| except | no | Defines a list of git refs for which build is not created |
| tags | no | Defines a list of tags which are used to select Runner |
@@ -427,6 +431,18 @@ job:
The above example will run `job` for all branches on `gitlab-org/gitlab-ce`,
except master.
+### job variables
+
+It is possible to define build variables using a `variables` keyword on a job
+level. It works basically the same way as its global-level equivalent but
+allows you to define job-specific build variables.
+
+When the `variables` keyword is used on a job level, it overrides global YAML
+build variables and predefined variables.
+
+Build variables priority is defined in
+[variables documentation](../variables/README.md).
+
### tags
`tags` is used to select specific Runners from the list of all Runners that are