Predefined CI/CD variables reference | GitLab Docs
/ Predefined CI/CD variables reference Tier : Free, Premium, Ultimate Offering : GitLab.com, GitLab Self-Managed, GitLab Dedicated Predefined CI/CD variables are available in every GitLab CI/CD pipeline. Avoid overriding predefined variables, as it can cause the pipeline to behave unexpectedly. Variable availability Predefined variables become available at three different phases of pipeline execution: Pre-pipeline: Pre-pipeline variables are available before the pipeline is created.
These variables are the only variables that can be used with include:rules to control which configuration files to use when creating the pipeline. Pipeline: Pipeline variables become available when GitLab is creating the pipeline. Along with pre-pipeline variables, pipeline variables can be used to configure rules defined in jobs, to determine which jobs to add to the pipeline. Job-only: These variables are only made available to each job when a runner picks up the job and runs it, and: Can be used in job scripts.
Cannot be used with trigger jobs . Cannot be used with workflow , include , or rules . Predefined variables Variable Availability Description CHAT_CHANNEL Pipeline The Source chat channel that triggered the ChatOps command. CHAT_INPUT Pipeline The additional arguments passed with the ChatOps command. CHAT_USER_ID Pipeline The chat service’s user ID of the user who triggered the ChatOps command. CI Pre-pipeline Available for all jobs executed in CI/CD. true when available.
CI_API_V4_URL Pre-pipeline The GitLab API v4 root URL. CI_API_GRAPHQL_URL Pre-pipeline The GitLab API GraphQL root URL. CI_BUILD_NETWORK_NAME Job-only The name of the network that the job created. Available only with the Docker executor when FF_NETWORK_PER_BUILD is enabled. CI_BUILDS_DIR Job-only The top-level directory where builds are executed. CI_COMMIT_AUTHOR Pre-pipeline The author of the commit in Name <email> format.
CI_COMMIT_BEFORE_SHA Pre-pipeline The previous latest commit present on a branch or tag. It is always 0000000000000000000000000000000000000000 for merge request pipelines, scheduled pipelines, the first commit in pipelines for branches or tags, or when manually running a pipeline. CI_COMMIT_BRANCH Pre-pipeline The commit branch name. Available in branch pipelines, including pipelines for the default branch. Not available in merge request pipelines or tag pipelines.
CI_COMMIT_DEFAULT_BRANCH_BASE_SHA Pre-pipeline The merge base between CI_COMMIT_SHA and the default branch. Available only in non-default branch pipelines. Introduced in GitLab 19.1. CI_COMMIT_DESCRIPTION Pre-pipeline The description of the commit. If the title is shorter than 100 characters, the description is the message without the first line. CI_COMMIT_MESSAGE Pre-pipeline The full commit message. CI_COMMIT_MESSAGE_IS_TRUNCATED Pre-pipeline true if CI_COMMIT_MESSAGE is truncated to the size specified in the GITLAB_CI_MAX_COMMIT_MESSAGE_SIZE_IN_BYTES system environment variable (default 100 KB) because the commit message is too long.
Otherwise false . Introduced in GitLab 18.6. CI_COMMIT_REF_NAME Pre-pipeline The branch or tag name for which project is built. CI_COMMIT_REF_PROTECTED Pre-pipeline true if the job is running for a protected reference, false otherwise. CI_COMMIT_REF_SLUG Pre-pipeline CI_COMMIT_REF_NAME in lowercase, shortened to 63 bytes, and with everything except 0-9 and a-z replaced with - . No leading / trailing - . Use in URLs, host names and domain names.
CI_COMMIT_SHA Pre-pipeline The commit revision the project is built for. CI_COMMIT_SHORT_SHA Pre-pipeline The first eight characters of CI_COMMIT_SHA . CI_COMMIT_TAG Pre-pipeline The commit tag name. Available only in pipelines for tags. CI_COMMIT_TAG_MESSAGE Pre-pipeline The commit tag message. Available only in pipelines for tags. CI_COMMIT_TIMESTAMP Pre-pipeline The timestamp of the commit in the ISO 8601 format. For example, 2022-01-31T16:47:55Z .
UTC by default . CI_COMMIT_TITLE Pre-pipeline The title of the commit. The full first line of the message. CI_COMMIT_USER_LOGIN Pre-pipeline The GitLab username of the commit author if the author’s profile and email are public and match the commit email, otherwise an empty string. Introduced in GitLab 18.10. CI_CONCURRENT_ID Job-only The unique ID of build execution in a single executor. CI_CONCURRENT_PROJECT_ID Job-only The unique ID of build execution in a single executor and project.
CI_CONFIG_PATH Pre-pipeline The path to the CI/CD configuration file. Defaults to .gitlab-ci.yml . CI_CONFIG_REF_URI Pipeline The fully qualified ref path to the top-level pipeline definition, for example gitlab.example.com/my-group/my-project//.gitlab-ci.yml@refs/heads/main . Not available when the pipeline source ref cannot be determined. Introduced in GitLab 19.0. CI_DEBUG_TRACE Pipeline true if debug logging (tracing) is enabled.
CI_DEBUG_SERVICES Pipeline true if service container logging is enabled. CI_DEFAULT_BRANCH Pre-pipeline The name of the project’s default branch. CI_DEFAULT_BRANCH_SLUG Pre-pipeline CI_DEFAULT_BRANCH in lowercase, shortened to 63 bytes, and with everything except 0-9 and a-z replaced with - . No leading / trailing - . Use in URLs, host names and domain names. CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX Pre-pipeline The direct group image prefix for pulling images through the Dependency Proxy.
CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX Pre-pipeline The top-level group image prefix for pulling images through the Dependency Proxy. CI_DEPENDENCY_PROXY_PASSWORD Pipeline The password to pull images through the Dependency Proxy. CI_DEPENDENCY_PROXY_SERVER Pre-pipeline The server for logging in to the Dependency Proxy. This variable is equivalent to $CI_SERVER_HOST:$CI_SERVER_PORT . CI_DEPENDENCY_PROXY_USER Pipeline The username to pull images through the Dependency Proxy.
CI_DEPLOY_FREEZE Pre-pipeline Only available if the pipeline runs during a deploy freeze window . true when available. CI_DEPLOY_PASSWORD Job-only The authentication password of the GitLab Deploy Token , if the project has one. CI_DEPLOY_USER Job-only The authentication username of the GitLab Deploy Token , if the project has one. CI_DISPOSABLE_ENVIRONMENT Pipeline Only available if the job runs in a disposable environment, which is created only for that job and destroyed afterward.
All executors support this except shell and ssh . true when available. CI_ENVIRONMENT_ID Pipeline The ID of the environment for this job. Available if environment:name is set. CI_ENVIRONMENT_NAME Pipeline The name of the environment for this job. Available if environment:name is set. CI_ENVIRONMENT_SLUG Pipeline The simplified version of the environment name, suitable for inclusion in DNS, URLs, and Kubernetes labels.
Available if environment:name is set. The slug is truncated to 24 characters . A random suffix is automatically added to uppercase environment names . CI_ENVIRONMENT_URL Pipeline The URL of the environment for this job. Available if environment:url is set. CI_ENVIRONMENT_ACTION Pipeline The action annotation specified for this job’s environment. Available if environment:action is set. Can be start , prepare , or stop .
CI_ENVIRONMENT_TIER Pipeline The deployment tier of the environment for this job. CI_GITLAB_FIPS_MODE Pre-pipeline Only available if FIPS mode is enabled in the GitLab instance. true when available. CI_HAS_OPEN_REQUIREMENTS Pipeline Only available if the pipeline’s project has an open requirement . true when available. CI_JOB_GROUP_NAME Pipeline The shared name of a group of jobs, when using either parallel or manually grouped jobs .
For example, if the job name is rspec:test: [ruby, ubuntu] , the CI_JOB_GROUP_NAME is rspec:test . It is the same as CI_JOB_NAME otherwise. Introduced in GitLab 17.10. CI_JOB_ID Job-only The internal ID of the job, unique across all jobs in the GitLab instance. CI_JOB_IMAGE Job-only The name of the Docker image running the job. Only available when the job explicitly specifies
The rest of this page is on the live site.