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

GitLab CI/CD Variables – GitLab Documentation

VariableDescription
CIMark that job is executed in CI environment
CI_COMMIT_REF_NAMEThe 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 names.
CI_COMMIT_SHAThe commit revision for which project is built
CI_COMMIT_TAGThe commit tag name. Present only when building tags.
CI_CONFIG_PATHThe path to CI config file. Defaults to .-ci.yml
CI_DEBUG_TRACEWhether debug tracing is enabled
CI_DISPOSABLE_ENVIRONMENTMarks 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 and ssh). If the environment is disposable, it is set to true, otherwise it is not defined at all.
CI_ENVIRONMENT_NAMEThe name of the environment for this job
CI_ENVIRONMENT_SLUGA simplified version of the environment name, suitable for inclusion in DNS, URLs, Kubernetes labels, etc.
CI_ENVIRONMENT_URLThe URL of the environment for this job
CI_JOB_IDThe unique id of the current job that GitLab CI uses internally
CI_JOB_MANUALThe flag to indicate that job was manually started
CI_JOB_NAMEThe name of the job as defined in .gitlab-ci.yml
CI_JOB_STAGEThe name of the stage as defined in .gitlab-ci.yml
CI_JOB_TOKENToken used for authenticating with the GitLab Container Registry. Also used to authenticate with multi-project pipelines when triggers are involved.
CI_REPOSITORY_URLThe URL to clone the repository
CI_RUNNER_DESCRIPTIONThe description of the runner as saved in GitLab
CI_RUNNER_IDThe unique id of runner being used
CI_RUNNER_TAGSThe defined runner tags
CI_PIPELINE_IDThe 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_TRIGGEREDThe flag to indicate that job was triggered
CI_PIPELINE_SOURCEThe source for this pipeline, one of: push, web, trigger, schedule, api, external. Pipelines created before 9.5 will have unknown as source
CI_PROJECT_DIRThe full path where the repository is cloned and where the job is run
CI_PROJECT_IDThe unique id of the current project that GitLab CI uses internally
CI_PROJECT_NAMEThe project name that is currently being built (actually it is project folder name)
CI_PROJECT_NAMESPACEThe project namespace (username or groupname) that is currently being built
CI_PROJECT_PATHThe 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_URLThe HTTP address to access project
CI_PROJECT_VISIBILITYThe project visibility (internal, private, public)
CI_REGISTRYIf the Container Registry is enabled it returns the address of GitLab’s Container Registry
CI_REGISTRY_IMAGEIf the Container Registry is enabled for the project it returns the address of the registry tied to the specific project
CI_REGISTRY_PASSWORDThe password to use to push containers to the GitLab Container Registry
CI_REGISTRY_USERThe username to use to push containers to the GitLab Container Registry
CI_SERVERMark that job is executed in CI environment
CI_SERVER_NAMEThe name of CI server that is used to coordinate jobs
CI_SERVER_REVISIONGitLab revision that is used to schedule jobs
CI_SERVER_VERSIONGitLab version that is used to schedule jobs
CI_SHARED_ENVIRONMENTMarks 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_ATTEMPTSNumber of attempts to download artifacts running a job
GET_SOURCES_ATTEMPTSNumber of attempts to fetch sources running a job
GITLAB_CIMark that job is executed in GitLab CI environment
GITLAB_USER_IDThe id of the user who started the job
GITLAB_USER_EMAILThe email of the user who started the job
GITLAB_USER_LOGINThe login username of the user who started the job
GITLAB_USER_NAMEThe real name of the user who started the job
RESTORE_CACHE_ATTEMPTSNumber of attempts to restore the cache running a job