Test Visibility is not available in the selected site () at this time.

Overview

If you run your tests inside a container that you launch yourself within the build (for example, using docker run or docker-compose), forward the following environment variables to the container depending on your CI provider. This enables the Datadog tracer to autodetect the build information.

Additionally, you need to pass in the environment variables required to configure the tracer as described in the per-language test instrumentation instructions (such as DD_SERVICE, DD_ENV, and a valid DD_TRACE_AGENT_URL that is accessible from within the container).

Manage environment variables

This table provides a non-exhaustive list of environment variables available for configuring the tracer:

Environment VariableDescription
APPVEYORIndicates if the build is running in the AppVeyor environment. Set to True (or true on Ubuntu image).
APPVEYOR_BUILD_IDA unique identifier for the AppVeyor build.
APPVEYOR_BUILD_NUMBERThe build number assigned by AppVeyor, which increments with each new build.
APPVEYOR_BUILD_FOLDERThe path to the directory where the repository is cloned.
APPVEYOR_REPO_PROVIDERSpecifies the source control provider for the repository, such as github, bitbucket, or kiln.
APPVEYOR_REPO_NAMEThe name of the repository in the format owner-name/repo-name.
APPVEYOR_REPO_BRANCHThe branch of the repository being built. For pull requests, it is the base branch the PR is merging into.
APPVEYOR_REPO_COMMITThe commit ID (SHA) of the current build.
APPVEYOR_REPO_TAG_NAMEThe tag name for builds started by a tag. This variable is undefined if the build is not triggered by a tag.
APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCHThe branch of the repository from which the pull request originated.
APPVEYOR_REPO_COMMIT_MESSAGEThe commit message associated with the current build.
APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDEDThe extended commit message, including any text after the first line break.
APPVEYOR_REPO_COMMIT_AUTHORThe name of the author of the commit.
APPVEYOR_REPO_COMMIT_AUTHOR_EMAILThe email address of the commit author.

For a comprehensive list of environment variables set by AppVeyor for every build, see the official AppVeyor documentation.

Environment VariableDescription
TF_BUILDIndicates that the build is running in Azure Pipelines.
BUILD_DEFINITIONNAMEThe name of the build pipeline.
BUILD_BUILDIDThe ID of the record for the completed build.
BUILD_SOURCESDIRECTORYThe local path on the agent where your source code files are downloaded.
BUILD_REPOSITORY_URIThe URL for the triggering repository.
BUILD_SOURCEBRANCHThe branch of the triggering repo the build was queued for.
BUILD_SOURCEVERSIONThe latest version control change of the triggering repo that is included in this build.
BUILD_SOURCEVERSIONMESSAGEThe comment of the commit or changeset for the triggering repo.
BUILD_REQUESTEDFORIDThe ID of the user who triggered the build.
BUILD_REQUESTEDFOREMAILThe email of the user who triggered the build.
SYSTEM_TEAMFOUNDATIONSERVERURIThe URI for the Team Foundation Server or Azure DevOps Services account.
SYSTEM_TEAMPROJECTIDThe ID of the team project for the build.
SYSTEM_JOBIDThe ID of the job being executed.
SYSTEM_TASKINSTANCEIDThe ID of the task instance within the job.
SYSTEM_PULLREQUEST_SOURCEREPOSITORYURIThe URL of the source repository for the pull request.
SYSTEM_PULLREQUEST_SOURCEBRANCHThe source branch of the pull request.
SYSTEM_PULLREQUEST_SOURCECOMMITIDThe commit ID of the source branch in the pull request.
SYSTEM_STAGEDISPLAYNAMEThe display name of the stage in the pipeline.
SYSTEM_JOBDISPLAYNAMEThe display name of the job in the pipeline.

For a comprehensive list of environment variables set by Azure DevOps Pipelines for every build, see the official Azure documentation.

Environment VariableDescription
BITBUCKET_PIPELINE_UUIDThe UUID of the pipeline.
BITBUCKET_BUILD_NUMBERThe unique identifier for a build. It increments with each build and can be used to create unique artifact names.
BITBUCKET_CLONE_DIRThe absolute path of the directory that the repository is cloned into within the Docker container.
BITBUCKET_REPO_FULL_NAMEThe full name of the repository (everything that comes after http://bitbucket.org/).
BITBUCKET_GIT_SSH_ORIGINYour SSH origin, for example: git@bitbucket.org:/<workspace>/<repo>.git.
BITBUCKET_COMMITThe commit hash of a commit that kicked off the build.
BITBUCKET_BRANCHThe source branch. This value is only available on branches. Not available for builds against tags, or custom pipelines.
BITBUCKET_TAGThe tag of a commit that kicked off the build. This value is only available on tags. Not available for builds against branches.

For a comprehensive list of environment variables set by Bitbucket for every build, see the official Bitbucket documentation.

Environment VariableDescription
BITRISE_BUILD_SLUGThe slug that uniquely identifies a build on bitrise.io. It’s part of the build URL.
BITRISE_TRIGGERED_WORKFLOW_IDThe ID of the Workflow that was triggered, exposed regardless of whether the Workflow was triggered manually or automatically.
BITRISE_BUILD_NUMBERBuild number of the build on bitrise.io.
BITRISE_BUILD_URLThe URL of the build on bitrise.io.
BITRISE_SOURCE_DIRPath to the base working directory. By default, it’s the directory where Bitrise runs, unless you provide a different value.
GIT_REPOSITORY_URLThe URL of the Git repository that hosts your app.
BITRISE_GIT_COMMITThe commit hash of the Git commit that triggered the build, when applicable.
GIT_CLONE_COMMIT_HASHThe hash of the commit that the build uses (the cloned commit).
BITRISEIO_GIT_BRANCH_DESTThe destination or target branch of the pull request that triggered the build, used only with builds triggered by pull requests.
BITRISE_GIT_BRANCHThe Git branch that is built by Bitrise, for example, main.
BITRISE_GIT_TAGIf a build is triggered by a Git tag, this environment variable stores the tag used.
BITRISE_GIT_MESSAGEThe commit message, pull request title, or the message you specified if you triggered the build manually.
BITRISE_APP_TITLEThe title of your app on bitrise.io.
GIT_CLONE_COMMIT_MESSAGE_SUBJECTThe subject of the commit message of the cloned commit.
GIT_CLONE_COMMIT_MESSAGE_BODYThe body (content) of the commit message of the cloned commit.
GIT_CLONE_COMMIT_AUTHOR_NAMEThe name of the author of the cloned commit.
GIT_CLONE_COMMIT_AUTHOR_EMAILThe email of the author of the cloned commit.
GIT_CLONE_COMMIT_COMMITER_NAMEThe name of the committer of the cloned commit.
GIT_CLONE_COMMIT_COMMITER_EMAILThe email of the committer of the cloned commit.

For a comprehensive list of environment variables set by Bitrise for every build, see the official Bitrise documentation.

Environment VariableDescription
BUILDKITEAlways true.
BUILDKITE_PIPELINE_SLUGThe pipeline slug on Buildkite as used in URLs.
BUILDKITE_JOB_IDThe internal UUID Buildkite uses for this job.
BUILDKITE_BUILD_IDThe UUID of the build.
BUILDKITE_BUILD_NUMBERThe build number. This number increases with every build and is unique within each pipeline.
BUILDKITE_BUILD_URLThe URL for this build on Buildkite.
BUILDKITE_BUILD_CHECKOUT_PATHThe path where the agent has checked out your code for this build.
BUILDKITE_REPOThe repository of your pipeline.
BUILDKITE_COMMITThe Git commit object of the build.
BUILDKITE_BRANCHThe branch being built.
BUILDKITE_TAGThe name of the tag being built, if this build was triggered from a tag.
BUILDKITE_MESSAGEThe message associated with the build, usually the commit message.
BUILDKITE_BUILD_AUTHORThe name of the user who authored the commit being built.
BUILDKITE_BUILD_AUTHOR_EMAILThe notification email of the user who authored the commit being built.
BUILDKITE_BUILD_CREATORThe name of the user who created the build.
BUILDKITE_BUILD_CREATOR_EMAILThe notification email of the user who created the build.
BUILDKITE_AGENT_IDThe UUID of the agent.
BUILDKITE_AGENT_META_DATA_*The value of each agent tag. The tag name is appended to the end of the variable name.

For a comprehensive list of environment variables set by Buildkite for every build, see the official Buildkite documentation.

Environment VariableDescription
CIRCLECIIndicates if the build is running in CircleCI. Always set to true.
CIRCLE_PROJECT_REPONAMEThe name of the repository being built.
CIRCLE_BUILD_NUMThe number of the current job. Job numbers are unique for each job.
CIRCLE_BUILD_URLThe URL for the current job on CircleCI.
CIRCLE_WORKFLOW_IDA unique identifier for the workflow instance of the current job.
CIRCLE_WORKING_DIRECTORYThe path to the working directory where the code is checked out.
CIRCLE_REPOSITORY_URLThe URL of the repository being built.
CIRCLE_SHA1The SHA1 hash of the last commit of the current build.
CIRCLE_BRANCHThe branch of the repository being built.
CIRCLE_TAGThe tag name if the current build is triggered by a tag; otherwise, it is empty.
CIRCLE_JOBThe name of the current job.

For a comprehensive list of environment variables set by CircleCI for every build, see the official CircleCI documentation.

Environment VariableDescription
CF_BUILD_IDThe unique ID of the build.
CF_PIPELINE_NAMEThe full path of the pipeline, including the project to which it is assigned, if any.
CF_BUILD_URLThe URL to the build in Codefresh.
CF_STEP_NAMEThe name of the step, for example, “MyUnitTests”.
CF_BRANCHThe branch name or tag of the Git repository associated with the main pipeline at the time of execution.
CF_REVISIONThe revision of the Git repository of the main pipeline, at the time of execution.

For a comprehensive list of environment variables set by Codefresh for every build, see the official Codefresh documentation.

Environment VariableDescription
GITHUB_ACTIONThe name of the action currently running, or the ID of a step. For example: repo-owner_name-of-action-repo.
GITHUB_SERVER_URLThe URL of the GitHub server. For example: https://github.com.
GITHUB_RUN_IDA unique number for each workflow run within a repository. For example: 1658821493.
GITHUB_RUN_NUMBERA unique number for each run of a particular workflow in a repository. For example: 3.
GITHUB_RUN_ATTEMPTA unique number for each attempt of a particular workflow run. For example: 3.
GITHUB_WORKFLOWThe name of the workflow. For example: My test workflow.
GITHUB_WORKSPACEThe default working directory on the runner for steps. For example: /home/runner/work/my-repo-name/my-repo-name.
GITHUB_REPOSITORYThe owner and repository name. For example: octocat/Hello-World.
GITHUB_SHAThe commit SHA that triggered the workflow. For example: ffac537e6cbbf934b08745a378932722df287a53.
GITHUB_HEAD_REFThe head ref or source branch of the pull request (only set for pull_request or pull_request_target events). For example: feature-branch-1.
GITHUB_REFThe fully-formed ref of the branch or tag that triggered the workflow. For example: refs/heads/feature-branch-1.
GITHUB_JOBThe job ID of the current job. For example: greeting_job.

For a comprehensive list of environment variables set by GitHub Actions for every build, see the official GitHub documentation.

Environment VariableDescription
GITLAB_CIAvailable for all jobs executed in CI/CD. true when available.
CI_PIPELINE_IDThe instance-level ID of the current pipeline. This ID is unique across all projects on the GitLab instance.
CI_PIPELINE_URLThe URL for the pipeline details.
CI_PIPELINE_IIDThe project-level IID (internal ID) of the current pipeline. Unique only within the current project.
CI_PROJECT_PATHThe project namespace with the project name included.
CI_PROJECT_DIRThe full path the repository is cloned to, and where the job runs from.
CI_JOB_STAGEThe name of the job’s stage.
CI_JOB_NAMEThe name of the job.
CI_JOB_URLThe job details URL.
CI_JOB_IDThe internal ID of the job, unique across all jobs in the GitLab instance.
CI_RUNNER_IDThe unique ID of the runner being used.
CI_RUNNER_TAGSA comma-separated list of the runner tags.
CI_REPOSITORY_URLThe full path to Git clone (HTTP) the repository with a CI/CD job token.
CI_COMMIT_SHAThe commit revision the project is built for.
CI_COMMIT_REF_NAMEThe branch or tag name for which project is built.
CI_COMMIT_BRANCHThe commit branch name. Available in branch pipelines.
CI_COMMIT_TAGThe commit tag name. Available only in pipelines for tags.
CI_COMMIT_AUTHORThe author of the commit in Name format.
CI_COMMIT_MESSAGEThe full commit message.
CI_COMMIT_TIMESTAMPThe timestamp of the commit in the ISO 8601 format. For example, 2022-01-31T16:47:55Z. UTC by default.

For a comprehensive list of environment variables set by GitLab CI for every build, see the official GitLab documentation.

Environment VariableDescription
JENKINS_URLThe URL of the Jenkins master that’s running the build.
BUILD_TAGA string of the form jenkins-${JOB_NAME}-${BUILD_NUMBER} for easier identification.
BUILD_NUMBERThe current build number, such as “153”.
BUILD_URLThe URL where the results of this build can be found (such as http://buildserver/jenkins/job/MyJobName/666/).
WORKSPACEThe absolute path of the workspace.
JOB_NAMEThe name of the project for this build.
JOB_URLThe URL for the job details.
GIT_URLThe Git URL used for the repository (such as git@github.com:user/repo.git or https://github.com/user/repo.git).
GIT_URL_1The URL of the first Git repository if multiple repositories are configured.
GIT_COMMITThe Git hash of the commit checked out for the build.
GIT_BRANCHThe Git branch that was checked out for the build.
NODE_NAMEThe name of the node the build is running on. Equals ‘master’ for the master node.
NODE_LABELSA comma-separated list of labels assigned to the node.
DD_CUSTOM_TRACE_IDCustom variable set by the Jenkins Datadog Plugin for trace IDs.
DD_CUSTOM_PARENT_IDCustom variable set by the Jenkins Datadog Plugin for parent IDs.

For a comprehensive list of environment variables set by Jenkins for every build, see the official Jenkins documentation.

Environment VariableDescription
TEAMCITY_VERSIONThe version of the TeamCity server.
TEAMCITY_BUILDCONF_NAMEThe name of the build configuration the current build belongs to.
BUILD_URLThe link to the current build.
DATADOG_BUILD_IDCustom variable set by the Datadog TeamCity Integration.

For a comprehensive list of environment variables set by TeamCity for every build, see the official TeamCity documentation.

Environment VariableDescription
TRAVISAlways set to true to indicate that the build is running on Travis CI.
TRAVIS_BUILD_IDThe ID of the current build used internally by Travis CI.
TRAVIS_BUILD_NUMBERThe number of the current build. For example: 4.
TRAVIS_BUILD_WEB_URLURL to the build log.
TRAVIS_BUILD_DIRThe absolute path to the directory where the repository being built has been copied on the worker.
TRAVIS_JOB_WEB_URLURL to the job log.
TRAVIS_REPO_SLUGThe slug (in form: owner_name/repo_name) of the repository currently being built.
TRAVIS_COMMITThe commit that the current build is testing.
TRAVIS_BRANCHFor push builds, the name of the branch. For PR builds, the name of the branch targeted by the PR.
TRAVIS_TAGIf the current build is for a Git tag, this variable is set to the tag’s name, otherwise it is empty.
TRAVIS_PULL_REQUEST_SLUGIf the current job is a pull request, the slug of the repository from which the PR originated.
TRAVIS_PULL_REQUEST_BRANCHIf the current job is a pull request, the name of the branch from which the PR originated.
TRAVIS_COMMIT_MESSAGEThe commit subject and body, unwrapped.

For a comprehensive list of environment variables set by Travis CI for every build, see the official Travis CI documentation.

Environment VariableDescription
BUDDYRepresents whether the current environment is a Buddy environment. For example: true.
BUDDY_SCM_URLThe URL of the repository synchronized with the project. For example: https://github.com/githubaccount/repository.
BUDDY_EXECUTION_REVISIONThe SHA1 hash of the commit of the current pipeline run. For example: 46c360492d6372e5335300776806af412755871.
BUDDY_EXECUTION_BRANCHThe name of the Git branch of the current pipeline run. For example: main.
BUDDY_EXECUTION_TAGThe name of the Git tag of the current pipeline run (if tagged). For example: v1.0.1.
BUDDY_PIPELINE_IDThe ID of the run pipeline. For example: 1.
BUDDY_EXECUTION_IDThe ID of the current pipeline run. For example: 1.
BUDDY_PIPELINE_NAMEThe name of the run pipeline. For example: Deploy to Production.
BUDDY_EXECUTION_URLThe URL of the current pipeline run. For example: https://app.buddy.works/my-workspace/my-project/pipelines/pipeline/1.
BUDDY_EXECUTION_REVISION_MESSAGEThe commit message of the currently run revision. For example: we need to write unit tests!.
BUDDY_EXECUTION_REVISION_COMMITTER_NAMEThe name of the committer of the currently run revision. For example: Mike Benson.
BUDDY_EXECUTION_REVISION_COMMITTER_EMAILThe email address of the committer of the currently run revision. For example: mike.benson@buddy.works.

For a comprehensive list of environment variables set by Buddy CI for every build, see the official Buddy CI documentation.

Further reading

Additional helpful documentation, links, and articles:

PREVIEWING: may/unit-testing