gitlab-ci 默认变量

摘自官方文档,留存以备用:

GitLab CI/CD Variables - GitLab Documentation

Variable Description
CI Mark that job is executed in CI environment
CI_COMMIT_REF_NAME The branch or tag name for which project is built
CI_COMMIT_REF_SLUG $CI_COMMIT_REF_NAME lowercased, shortened to 63 bytes, and with everything except 0-9 and a-zreplaced with -. No leading / trailing -. Use in URLs, host names and domain names.
CI_COMMIT_SHA The commit revision for which project is built
CI_COMMIT_TAG The commit tag name. Present only when building tags.
CI_CONFIG_PATH The path to CI config file. Defaults to .gitlab-ci.yml
CI_DEBUG_TRACE Whether debug tracing is enabled
CI_DISPOSABLE_ENVIRONMENT Marks that the job is executed in a disposable environment (something that is created only for this job and disposed of/destroyed after the execution - all executors except shell and ssh). If the environment is disposable, it is set to true, otherwise it is not defined at all.
CI_ENVIRONMENT_NAME The name of the environment for this job
CI_ENVIRONMENT_SLUG A simplified version of the environment name, suitable for inclusion in DNS, URLs, Kubernetes labels, etc.
CI_ENVIRONMENT_URL The URL of the environment for this job
CI_JOB_ID The unique id of the current job that GitLab CI uses internally
CI_JOB_MANUAL The flag to indicate that job was manually started
CI_JOB_NAME The name of the job as defined in .gitlab-ci.yml
CI_JOB_STAGE The name of the stage as defined in .gitlab-ci.yml
CI_JOB_TOKEN Token used for authenticating with the GitLab Container Registry. Also used to authenticate with multi-project pipelines when triggers are involved.
CI_REPOSITORY_URL The URL to clone the Git repository
CI_RUNNER_DESCRIPTION The description of the runner as saved in GitLab
CI_RUNNER_ID The unique id of runner being used
CI_RUNNER_TAGS The defined runner tags
CI_PIPELINE_ID The unique id of the current pipeline that GitLab CI uses internally
CI_PIPELINE_SOURCE (EEP) The variable indicates how the pipeline was triggered, possible options are: push, web, trigger, schedule, api, pipeline
CI_PIPELINE_TRIGGERED The flag to indicate that job was triggered
CI_PIPELINE_SOURCE The source for this pipeline, one of: push, web, trigger, schedule, api, external. Pipelines created before 9.5 will have unknown as source
CI_PROJECT_DIR The full path where the repository is cloned and where the job is run
CI_PROJECT_ID The unique id of the current project that GitLab CI uses internally
CI_PROJECT_NAME The project name that is currently being built (actually it is project folder name)
CI_PROJECT_NAMESPACE The project namespace (username or groupname) that is currently being built
CI_PROJECT_PATH The namespace with project name
CI_PROJECT_PATH_SLUG $CI_PROJECT_PATH lowercased and with everything except 0-9 and a-z replaced with -. Use in URLs and domain names.
CI_PROJECT_URL The HTTP address to access project
CI_PROJECT_VISIBILITY The project visibility (internal, private, public)
CI_REGISTRY If the Container Registry is enabled it returns the address of GitLab’s Container Registry
CI_REGISTRY_IMAGE If the Container Registry is enabled for the project it returns the address of the registry tied to the specific project
CI_REGISTRY_PASSWORD The password to use to push containers to the GitLab Container Registry
CI_REGISTRY_USER The username to use to push containers to the GitLab Container Registry
CI_SERVER Mark that job is executed in CI environment
CI_SERVER_NAME The name of CI server that is used to coordinate jobs
CI_SERVER_REVISION GitLab revision that is used to schedule jobs
CI_SERVER_VERSION GitLab version that is used to schedule jobs
CI_SHARED_ENVIRONMENT Marks that the job is executed in a shared environment (something that is persisted across CI invocations like shell or ssh executor). If the environment is shared, it is set to true, otherwise it is not defined at all.
ARTIFACT_DOWNLOAD_ATTEMPTS Number of attempts to download artifacts running a job
GET_SOURCES_ATTEMPTS Number of attempts to fetch sources running a job
GITLAB_CI Mark that job is executed in GitLab CI environment
GITLAB_USER_ID The id of the user who started the job
GITLAB_USER_EMAIL The email of the user who started the job
GITLAB_USER_LOGIN The login username of the user who started the job
GITLAB_USER_NAME The real name of the user who started the job
RESTORE_CACHE_ATTEMPTS Number of attempts to restore the cache running a job