📌  相关文章
📜  GitLab-CI / CD变量

📅  最后修改于: 2020-11-01 03:46:55             🧑  作者: Mango


下表显示了GitLab CI / CD变量列表。

S.No. Variable GitLab Runner Description
1 CI all 0.4 Specifies that job is accomplished in CI environment.
2 CI_COMMIT_REF_NAME 9.0 all Defines the branch or tag name for project build.
3 CI_COMMIT_REF_SLUG 9.0 all It uses the lowercased $CI_COMMIT_REF_NAME variable which is reduced to 63 bytes, and only 0-9 and a-z replaced with -.
4 CI_COMMIT_SHA 9.0 all Specifies the commit revision for built project.
5 CI_COMMIT_TAG 9.0 0.5 It commits the tag name
6 CI_CONFIG_PATH 9.4 0.5 Specifies the path to CI config file. (The default path is .gitlab-ci.yml).
7 CI_DEBUG_TRACE all 1.7 It enables the debug tracing.
8 CI_ENVIRONMENT_NAME 8.15 all Defines the environment name for the job.
9 CI_ENVIRONMENT_SLUG 8.15 all It is a environment name, suitable for DNS, URLs, Kubernetes labels, etc.
10 CI_ENVIRONMENT_URL 9.3 all Defines the environment URL for the job.
11 CI_JOB_ID 9.0 all Represents the unique id of the current job for GitLab CI.
12 CI_JOB_MANUAL 8.12 all It specifies that job has been started manually.
13 CI_JOB_NAME 9.0 0.5 The job name is defined in the .gitlab-ci.yml file.
14 CI_JOB_STAGE 9.0 0.5 The stage name is defined in the .gitlab-ci.yml file.
15 CI_JOB_TOKEN 9.0 1.2 This token is used for authenticating with the GitLab Container Registry and multi-project pipelines when triggers are involved.
16 CI_REPOSITORY_URL 9.0 all It specifies the URL to clone the Git repository.
17 CI_RUNNER_DESCRIPTION 8.10 0.5 It specifies the description for the runner.
18 CI_RUNNER_ID 8.10 0.5 It provides the unique id for runner being used.
19 CI_RUNNER_TAGS 8.10 0.5 It defines the runner tags.
20 CI_RUNNER_VERSION all 10.6 It specifies the GitLab runner version of the current job.
21 CI_RUNNER_REVISION all 10.6 It specifies the GitLab revision of the current job.
22 CI_PIPELINE_ID 8.10 0.5 It provides the unique id of the current pipeline.
23 CI_PIPELINE_SOURCE 9.3 all It specifies how the pipeline was triggered by using some options such as push, web, trigger, schedule, api, pipeline.
24 CI_PIPELINE_TRIGGERED all all It specifies that job was triggered.
25 CI_PIPELINE_SOURCE 10.0 all It specifies source of the pipeline such as push, web, trigger, schedule, api, external.
26 CI_PROJECT_DIR all all It defines the full path of the cloned repository, where the job is run.
27 CI_PROJECT_ID all all It provides the unique id of the current project.
28 CI_PROJECT_NAME 8.10 0.5 It provides the name of the current project.
29 CI_PROJECT_PATH 8.10 0.5 It provides the name of the project along with namespace.
30 CI_PROJECT_URL 8.10 0.5 It gives the http address to retrieve the project.
31 CI_PROJECT_VISIBILITY 10.3 all It specifies the project visibility whether it is internal, private or public.
32 CI_REGISTRY 8.10 0.5 It returns the address of GitLab’s Container Registry, only if the Container Registry is enabled.
33 CI_REGISTRY_IMAGE 8.10 0.5 It returns the address of GitLab’s Container Registry which is tied to specific project, only if the Container Registry is enabled.
34 CI_REGISTRY_PASSWORD 9.0 all The password can be used to push the containers to the GitLab Container Registry.
35 CI_REGISTRY_USER 9.0 all The username can be used to push the containers to the GitLab Container Registry.
36 CI_SERVER all all It specifies that job is executed in CI environment.
37 CI_SERVER_NAME all all It gives the CI server name to coordinate the jobs.
38 CI_SERVER_REVISION all all It is used to schedule the jobs by using GitLab revision.
39 CI_SERVER_VERSION all all It is used to schedule the jobs by using GitLab version.
40 CI_SHARED_ENVIRONMENT all 10.1 It indicates that job is executed in a shared environment and it is set to true, if the environment is shared.
41 ARTIFACT_DOWNLOAD_ATTEMPTS 8.15 1.9 It specifies the number of attempts to download artifacts running a job.
42 GET_SOURCES_ATTEMPTS 8.15 1.9 It specifies the number of attempts to get the sources running a job.
43 GITLAB_CI all all It specifies that job is accomplished in GitLab CI environment.
44 GITLAB_USER_ID 8.12 all It specifies the id of GitLab user who is running a job.
45 GITLAB_USER_EMAIL 8.12 all It specifies the email of GitLab user who is running a job.
46 GITLAB_USER_LOGIN 10.0 all It specifies the login username of GitLab user who is running a job.
47 GITLAB_USER_NAME 10.0 all It specifies the real name of GitLab user who is running a job.
48 GITLAB_FEATURES 10.6 all It provides list of the licensed features for the GitLab instance and plan.
49 RESTORE_CACHE_ATTEMPTS 8.15 1.9 It defines number of cache attempts to restore the running a job.
50 CI_DISPOSABLE_ENVIRONMENT all 10.1 It indicates that job is executed in a disposable environment and it is set to true, if the environment is disposable.

下表显示了可与GitLab 9.0版本一起使用的新变量的列表-

S.No. 9.0+ name
1 CI_JOB_ID
2 CI_COMMIT_SHA
3 CI_COMMIT_TAG
4 CI_COMMIT_REF_NAME
5 CI_COMMIT_REF_SLUG
6 CI_JOB_NAME
7 CI_JOB_STAGE
8 CI_REPOSITORY_URL
9 CI_PIPELINE_TRIGGERED
10 CI_JOB_MANUAL
11 CI_JOB_TOKEN