Documentation structure for LLMs (llms.txt)

Project values and variables

Cloud Server

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

CI

GitHub, Bitbucket, GitLab, Cursor Origin

Boolean

true (represents whether the current environment is a CI environment)

Yes

Yes

CIRCLECI

GitHub, Bitbucket, GitLab, Cursor Origin

Boolean

true (represents whether the current environment is a CircleCI environment)

Yes

Yes

CIRCLE_BRANCH

GitHub, Bitbucket, GitLab, Cursor Origin

String

The name of the Git branch currently being built.

Yes

Yes

CIRCLE_BUILD_NUM

GitHub, Bitbucket, GitLab, Cursor Origin

Integer

The number of the current job. Job numbers are unique for each job.

Yes

Yes

CIRCLE_BUILD_URL

GitHub, Bitbucket, GitLab, Cursor Origin

String

The URL for the current job on CircleCI.

Yes

Yes

CIRCLE_JOB

GitHub, Bitbucket, GitLab, Cursor Origin

String

The name of the current job.

Yes

Yes

CIRCLE_NODE_INDEX

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 (CIRCLE_NODE_TOTAL - 1).

Yes

Yes

CIRCLE_NODE_TOTAL

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 parallelism in your config file.

Yes

Yes

CIRCLE_OIDC_TOKEN

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

CIRCLE_OIDC_TOKEN_V2

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

CIRCLE_ORGANIZATION_ID

GitHub, Bitbucket, GitLab, Cursor Origin

String

A unique identifier for the CircleCI organization.

Yes

Yes

CIRCLE_PIPELINE_ID

GitHub, Bitbucket, GitLab, Cursor Origin

String

A unique identifier for the current pipeline.

Yes

Yes

CIRCLE_PR_NUMBER

GitHub OAuth, Bitbucket Cloud

Integer

The number of the associated GitHub or Bitbucket pull request. Only available on forked PRs.

Yes

Yes

CIRCLE_PR_REPONAME

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

CIRCLE_PR_USERNAME

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

CIRCLE_PROJECT_ID

GitHub, Bitbucket, GitLab, Cursor Origin

String

A unique identifier for the current project.

Yes

Yes

CIRCLE_PROJECT_REPONAME

GitHub, GitLab, Bitbucket, Cursor Origin

String

The name of the repository of the current project.

Yes

Yes

CIRCLE_PROJECT_USERNAME

GitHub, GitLab, Bitbucket, Cursor Origin

String

The GitHub or Bitbucket username of the current project.

Yes

Yes

CIRCLE_PULL_REQUEST

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

CIRCLE_PULL_REQUESTS

GitHub OAuth, Bitbucket Cloud

List

Comma-separated list of URLs of the current build’s associated pull requests.

Yes

Yes

CIRCLE_REPOSITORY_URL

GitHub OAuth, Bitbucket Cloud

String

The URL of your GitHub or Bitbucket repository.

Yes

Yes

CIRCLE_SHA1

GitHub, GitLab, Bitbucket, Cursor Origin

String

The SHA1 hash of the last commit of the current build.

Yes

Yes

CIRCLE_TAG

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

CIRCLE_USERNAME

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

CIRCLE_WORKFLOW_ID

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

CIRCLE_WORKFLOW_JOB_ID

GitHub, Bitbucket, GitLab, Cursor Origin

String

A unique identifier for the current job.

Yes

Yes

CIRCLE_WORKFLOW_WORKSPACE_ID

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

CIRCLE_WORKING_DIRECTORY

GitHub, Bitbucket, GitLab, Cursor Origin

String

The value of the working_directory key of the current job.

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

pipeline.id

GitHub App
GitHub App Server
GitHub OAuth
Bitbucket Cloud
GitLab
Cursor Origin

String

A globally unique identifier for the pipeline.

Yes

Yes

pipeline.number

GitHub App
GitHub App Server
GitHub OAuth
Bitbucket Cloud
GitLab
Cursor Origin

Integer