Environment configuration for CI
This page describes how to configure Diffblue Cover CLI using environment variables. This is predominantly related to Diffblue Cover Pipeline and CI configuration.
General Environment Variables
This section describes environment variables that are supported in Diffblue Cover CLI and not specific to CI environments.
Environment Variable | Notes |
---|---|
| The Diffblue license key provided in your welcome email. |
| The contents of the |
Pipeline & CI Environment Variables
This section describes all the Cover Pipeline and continuous integration related environment variables and configuration.
To use Cover's generic CI functionality the CI
environment variable must be set to true
. Note that most CI environments (including GitHub, GitLab, and Jenkins) configure this by default.
The following table lists all the environment variables related to CI.
Environment Variable | Notes |
---|---|
| The git name of the branch that the tests will be written for and committed to. |
| The SHA of the latest commit in the branch to write tests for. |
| The name of the branch the change request (or |
| The SHA of the latest commit before this branch was forked. |
| The full path to the git remote repository (if not specified, this will be read from the local git configuration). |
| The git credentials access token. This should give the user permissions to pull and push to the git repository. |
| The name of the access token. |
| The author name that Diffblue Cover Pipeline will use in the git repository. |
| The email that Diffblue Cover Pipeline will use in the git repository. |
| When set to |
| When set to |
| When set to |
Repository Access Configuration
Cover is designed to work with your existing git configuration. This means:
If
DIFFBLUE_REPOSITORY_URL
is not specified, Cover will use the remote URL from your local git configuration.If
DIFFBLUE_ACCESS_TOKEN
andDIFFBLUE_ACCESS_TOKEN_NAME
are not provided, Cover assumes that access is already configured (e.g., via SSH) and will use the existing git configuration for pushing changes.
This flexibility allows Cover to integrate seamlessly with various CI environments and git configurations.
Branch and Commit Behavior
Head Branch and Commit
When neither
DIFFBLUE_HEAD_BRANCH
norDIFFBLUE_HEAD_SHA
are specified then Cover will proceed as 2. below assuming thatDIFFBLUE_HEAD_BRANCH
is the current git branch.When only
DIFFBLUE_HEAD_BRANCH
is specified (withoutDIFFBLUE_HEAD_SHA
):Cover will attempt to determine the HEAD commit of the specified branch.
Cover first looks for a local branch with the given name.
If not found locally, Cover checks for a remote-tracking branch.
If still not found, Cover tries to fetch the remote branch.
If successful, Cover uses the HEAD commit of the found branch.
If unsuccessful, an error will be thrown.
When both
DIFFBLUE_HEAD_BRANCH
andDIFFBLUE_HEAD_SHA
are specified:Cover uses the provided SHA directly.
Cover verifies that the SHA exists in the repository.
If the SHA doesn't exist, Cover will attempt to fetch it.
Base Branch and Commit
When only
DIFFBLUE_BASE_BRANCH
is specified:Cover follows a similar process as with the head branch to find the base commit.
Cover looks for local, then remote-tracking, then remote branches.
The HEAD of the found branch is used as the base commit.
When only
DIFFBLUE_BASE_SHA
is specified:Cover uses this SHA directly as the base commit.
Cover verifies the SHA exists in the repository and fetches it if necessary.
When both
DIFFBLUE_BASE_BRANCH
andDIFFBLUE_BASE_SHA
are specified:Cover uses the provided SHA as the base commit.
The branch name is used for reference but doesn't affect the chosen commit.
When neither is specified:
Finding Common Ancestor
If both base and head commits are successfully determined, Cover finds their common ancestor.
This common ancestor is used as the actual base for patch mode operations.
If no common ancestor is found within a reasonable search depth, an error is thrown.
Last updated