Project values and variables
This page is a reference for all built-in values available for use in your CircleCI projects.
Built-in environment variables
The following built-in environment variables are available for CircleCI projects. Some environment variables are available for GitHub OAuth and Bitbucket Cloud projects and are deprecated for GitLab, GitHub App, and GitHub Enterprise Server support. If you must continue to use those as environment variables in your GitLab pipelines, refer to the workaround described after the list below.
Environment variables are scoped at the job level and can be used within the context of a job. Environment variables do not exist at a pipeline level, therefore they cannot be used for any logic at the pipeline or workflow level.
You cannot use a built-in environment variable to define another environment variable. Instead, you must use a run step to export the new environment variables using BASH_ENV. For more details, see Setting an Environment Variable in a Shell Command.
|
| Variable | VCS | Type | Value | Cloud | Server |
|---|---|---|---|---|---|
|
GitHub, Bitbucket, GitLab, Cursor Origin |
Boolean |
|
Yes |
Yes |
|
GitHub, Bitbucket, GitLab, Cursor Origin |
Boolean |
|
Yes |
Yes |
|
GitHub, Bitbucket, GitLab, Cursor Origin |
String |
The name of the Git branch currently being built. |
Yes |
Yes |
|
GitHub, Bitbucket, GitLab, Cursor Origin |
Integer |
The number of the current job. Job numbers are unique for each job. |
Yes |
Yes |
|
GitHub, Bitbucket, GitLab, Cursor Origin |
String |
The URL for the current job on CircleCI. |
Yes |
Yes |
|
GitHub, Bitbucket, GitLab, Cursor Origin |
String |
The name of the current job. |
Yes |
Yes |
|
GitHub, Bitbucket, GitLab, Cursor Origin |
Integer |
For jobs that run with parallelism enabled, this is the index of the current parallel run. The value ranges from 0 to ( |
Yes |
Yes |
|
GitHub, Bitbucket, GitLab, Cursor Origin |
Integer |
For jobs that run with parallelism enabled, this is the number of parallel runs. The value is equivalent to the value of |
Yes |
Yes |
|
GitHub, Bitbucket, GitLab, Cursor Origin |
String |
An OpenID Connect token signed by CircleCI which includes details about the current job. |
Yes |
Yes from v4.4 |
|
GitHub, Bitbucket, GitLab, Cursor Origin |
String |
An OpenID Connect token signed by CircleCI which includes details about the current job. |
Yes |
Yes from v4.4 |
|
GitHub, Bitbucket, GitLab, Cursor Origin |
String |
A unique identifier for the CircleCI organization. |
Yes |
Yes |
|
GitHub, Bitbucket, GitLab, Cursor Origin |
String |
A unique identifier for the current pipeline. |
Yes |
Yes |
|
GitHub OAuth, Bitbucket Cloud |
Integer |
The number of the associated GitHub or Bitbucket pull request. Only available on forked PRs. |
Yes |
Yes |
|
GitHub OAuth, Bitbucket Cloud |
String |
The name of the GitHub or Bitbucket repository where the pull request was created. Only available on forked PRs. |
Yes |
Yes |
|
GitHub OAuth, Bitbucket Cloud |
String |
The GitHub or Bitbucket username of the user who created the pull request. Only available on forked PRs. |
Yes |
Yes |
|
GitHub, Bitbucket, GitLab, Cursor Origin |
String |
A unique identifier for the current project. |
Yes |
Yes |
|
GitHub, GitLab, Bitbucket, Cursor Origin |
String |
The name of the repository of the current project. |
Yes |
Yes |
|
GitHub, GitLab, Bitbucket, Cursor Origin |
String |
The GitHub or Bitbucket username of the current project. |
Yes |
Yes |
|
GitHub, Bitbucket Cloud |
String |
The URL of the associated pull request. If there are multiple associated pull requests, one URL is randomly chosen. |
Yes |
Yes |
|
GitHub OAuth, Bitbucket Cloud |
List |
Comma-separated list of URLs of the current build’s associated pull requests. |
Yes |
Yes |
|
GitHub OAuth, Bitbucket Cloud |
String |
The URL of your GitHub or Bitbucket repository. |
Yes |
Yes |
|
GitHub, GitLab, Bitbucket, Cursor Origin |
String |
The SHA1 hash of the last commit of the current build. |
Yes |
Yes |
|
GitHub, Bitbucket, GitLab, Cursor Origin |
String |
The name of the git tag, if the current build is tagged. For more information, see the Git tag job execution section of the Workflows page. |
Yes |
Yes |
|
GitHub, Bitbucket, GitLab |
String |
The GitHub or Bitbucket username of the user who triggered the pipeline (only if the user has a CircleCI account). |
Yes |
Yes |
|
GitHub, Bitbucket, GitLab, Cursor Origin |
String |
A unique identifier for the workflow instance of the current job. This identifier is the same for every job in a given workflow instance. |
Yes |
Yes |
|
GitHub, Bitbucket, GitLab, Cursor Origin |
String |
A unique identifier for the current job. |
Yes |
Yes |
|
GitHub, Bitbucket, GitLab, Cursor Origin |
String |
An identifier for the workspace of the current job. This identifier is the same for every job in a given workflow. |
Yes |
Yes |
|
GitHub, Bitbucket, GitLab, Cursor Origin |
String |
The value of the |
Yes |
Yes |
If you must use the environment variables that are deprecated for GitLab SaaS in your GitLab pipelines, you can recreate this functionality using pipeline values in your configuration file. The following example shows how to set an environment variable CIRCLE_PROJECT_REPONAME using the environment key and populating it with the pipeline.trigger_parameters.gitlab.repo_name value:
build:
docker:
- image: cimg/node:17.0
auth:
username: mydockerhub-user
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
environment:
CIRCLE_PROJECT_REPONAME: << pipeline.trigger_parameters.gitlab.repo_name >>
steps:
- run: echo $CIRCLE_PROJECT_REPONAME
Pipeline values
Pipeline values are available to all pipeline configurations and can be used without previous declaration. Pipeline values are scoped at the pipeline level. They are interpolated at compilation time, not workflow/job runtime.
The pipeline values available to you depend on your pipeline/integration type, as shown in the "Source" column of each table below. The tables below group values by their purpose and namespace.
Pipeline and project information
These values provide core identifiers for the pipeline itself and the project it belongs to. They are available across all pipeline types and integration methods.
| Variable | Pipeline type | Type | Value | Cloud | Server |
|---|---|---|---|---|---|
|
GitHub App |
String |
A globally unique identifier for the pipeline. |
Yes |
Yes |
|
GitHub App |
Integer |