LogoLogo
diffblue.comFree trial
  • Discover Diffblue Cover
  • Get Started
    • What is Diffblue Cover?
    • Get started
      • Free trial
      • Get started - Cover Plugin
      • Get started - Cover CLI
      • Get started - Cover Pipeline
      • Get started - Cover Reports
    • Specs & Reqs
    • Reference Deployments
    • Licensing
      • Online license activation
      • Offline license activation
      • Diffblue License Manager
    • Update Cover
    • FAQs
    • Diffblue Learning
      • Get started
        • Just the basics
        • Free trial
        • Cover Plugin (IDE)
        • Cover CLI (Command Line)
      • Developer
        • Unit tests (IDE)
        • Unit tests (CLI)
        • Test coverage
      • DevOps
        • GitHub
        • GitLab
        • Other CI
      • Administrator
        • Admin - IntelliJ
        • Admin - CLI
        • Admin - Reports
      • Test coverage
        • Developer
        • Senior developer
        • Cover Reports Administrator
  • EVALUATION & ONBOARDING
    • Proof of Value
    • Jumpstart
      • Prerequisites for onboarding
      • Phase 1: Up and running
        • Module 1: Create your Cover unit test baseline
        • Module 2: Cover Pipeline CI integration
      • Phase 2: Developer productivity
        • Module 3: Getting started using Cover
        • Module 4: Introduction to Cover Reports
      • Phase 3: Advanced topics
        • Module 5: Speed up your test execution
        • Module 6: Getting more from Cover
  • Features
    • Cover Plugin
      • Writing tests
        • Gutter icons
        • Menu options
        • Run configurations
        • Cover Plugin tool window
        • Test Review
        • Test examples
        • Creating partial tests
        • Creating skeleton tests
        • Covering all enum values
        • Test insertion order
        • Diffblue Sandbox
        • Environment Check Cache
      • Project configuration
        • General dependencies
        • Test framework dependencies
      • Cover Plugin settings
        • Test Naming
        • Test Formatting
        • Spring configuration options
        • Method Annotations
        • Test Directory
        • Reset Cover Plugin settings
      • Cover Plugin admin
        • Core Maintenance
        • Cover Plugin toolbar menu
        • Cover Plugin status bar widget
        • Telemetry
        • Memory management
        • Using SonarQube with Cover Plugin
        • Log files
        • Troubleshooting
    • Cover CLI
      • Writing tests
        • Command summary
        • Test examples
        • Creating partial tests
        • Customizing test inputs
        • Customizing test setup
        • Test naming
        • Test formatting
        • Test insertion order
        • Patch files
        • Diffblue Sandbox
        • Operational behaviors
        • Test validation
      • Project configuration
        • Preflight checks
        • General dependencies
        • Test framework dependencies
        • Compiling your project successfully
          • Building a Maven project
          • Building a Gradle project
        • Configuring Cover to work with your project's build system
          • Quick guide
          • Configuration file in detail
          • Getting Started with Ant Projects
          • Default configuration
        • Mocking using Mockito
        • Spring profiles
        • Runtime environment
      • Commands & Arguments
        • Environment configuration for CI
        • Packages, classes, and methods
        • Quoting command line arguments
        • Argument files
      • Cover CLI admin
        • Core Maintenance
        • Telemetry
        • Memory management
        • Using Cover CLI in Eclipse
        • Using SonarQube with Cover CLI
        • Log files
        • Troubleshooting
      • Environment Configuration
    • Cover Pipeline
      • Cover Pipeline for CI
        • Quick Start - General
        • Quick Start - Jenkins
        • Quick Start - Azure Pipelines
        • Quick Start - AWS Codebuild
        • Integrating Diffblue Cover into CI on pull requests
        • Installation - VMs or CI run
      • Cover Pipeline for GitLab
        • Introduction
        • Installation and initial setup
        • GitLab workflow
        • Configuration
        • Troubleshooting
        • Related topics
      • Cover Pipeline for GitHub
        • Introduction
        • Installation and initial setup
        • GitHub workflow
        • Configuration
        • Troubleshooting
        • Related topics
    • Cover Reports
      • Cover Reports Contributor
        • Java project config (JaCoCo)
        • Generate and upload reports bundles
        • Authenticated uploads
      • Cover Reports User
        • Navigation
        • Dashboards
        • Telemetry data
        • Export API
        • Considerations
      • Cover Reports Administrator
        • Install and update Cover Reports
        • Configuration options
        • Database backup
        • SSO with Cover Reports
        • Uninstall Cover Reports
    • Cover Optimize
      • Get started - Cover Optimize
      • Cover Optimize & Gradle
      • Cover Optimize & Maven
      • Patch files
    • Cover Refactor
      • Get started - Cover Refactor
    • Cover Annotations
      • Mocking Annotations
      • Custom Input Annotations
      • Interesting Value Annotations
    • Output Codes
      • E - Environment Codes
      • L - License Codes
      • R - Reason Codes
      • T - Testability Codes
      • V - Validation Codes
      • Working with output codes
        • Working with code E020
        • Working with codes E057 to E065
        • Working with code E085
        • Working with code R005
        • Working with code R006
        • Working with code R008
        • Working with code R011
        • Working with code R012
        • Working with code R013
        • Working with code R026
        • Working with code R031
        • Working with code V003
    • Tutorials
      • How to measure test quality
      • How to improve code coverage
      • How to test a new feature
      • How to find regressions
      • How to use Diffblue Cover in test driven development (TDD)
      • How to write tests for Kotlin projects
      • Examples of tests created by Diffblue Cover
      • Best practices for testing private methods
  • Updates & Upgrades
    • Update Cover
    • Cover Editions
    • What's new
    • Release archive
      • 2025-05-01
      • 2025-04-02
      • 2025-04-01
      • 2025-03-02
      • 2025-03-01
      • 2025-02-02
      • 2025-02-01
      • 2025-01-02
      • 2025-01-01
      • 2024-12-02
      • 2024-12-01
      • 2024-11-02
      • 2024-11-01
      • 2024-10-02
      • 2024-10-01
      • 2024-09-02
      • 2024-09-01
      • 2024-08-02
      • 2024-08-01
      • 2024-07-04
      • 2024-07-03
      • 2024-07-01
      • 2024-06-02
      • 2024-06-01
      • 2024-05-02
      • 2024-05-01
      • 2024-04-02
      • 2024-04-01
      • 2024-03-02
      • 2024-03-01
      • 2024-02-02
      • 2024-02-01
      • 2024-01-02
      • 2024-01-01
      • 2023-12-02
      • 2023-12-01
      • 2023-11-03
      • 2023-11-02
      • 2023-11-01
      • 2023-10-02
      • 2023-10-01
      • 2023-09-02
      • 2023-09-01
      • 2023-08-02
      • 2023-08-01
      • 2023-07-03
      • 2023-07-02
      • 2023-07-01
      • 2023-06-02
      • 2023-06-01
      • 2023-05-02
      • 2023-05-01
      • 2023-04-02
      • 2023-04-01
      • 2023-03-02
      • 2023-03-01
      • 2023-02-02
      • 2023-02-01
      • 2023-01-02
      • 2023-01-01
      • 2022-12-02
      • 2022-12-01
      • 2022-11-02
      • 2022-11-01
      • 2022-10-03
      • 2022-10-02
      • 2022-10-01
      • 2022-09-02
      • 2022-09-01
      • 2022-08-05
      • 2022-08-03
      • 2022-08-02
      • 2022-08-01
      • 2022-07-02
      • 2022-07-01
      • 2022-06-02
      • 2022-06-01
      • 2022-05-02
      • 2022-05-01
      • 2022-04-02
      • 2022-04-01
      • 2022-03-02
      • 2022-03-01
      • 2022-02-02
      • 2022-02-01
      • 2022-01-02
      • 2022-01-01
      • 2021-06-02
      • 2021-02-01
  • Legal
    • Diffblue Legal
      • Diffblue End User License Agreement (EULA)
      • Cover Third Party Notices and/or Licenses
      • Privacy Notice
Powered by GitBook
On this page
  • General Environment Variables
  • Pipeline & CI Environment Variables
  • Repository Access Configuration
  • Branch and Commit Behavior

Was this helpful?

Export as PDF
  1. Features
  2. Cover CLI
  3. Commands & Arguments

Environment configuration for CI

PreviousCommands & ArgumentsNextPackages, classes, and methods

Last updated 5 months ago

Was this helpful?

This page describes how to configure Diffblue Cover CLI using environment variables. This is predominantly related to Diffblue Cover Pipeline and CI configuration.

The environment can be configured in several ways which are described in

General Environment Variables

This section describes environment variables that are supported in Diffblue Cover CLI and not specific to CI environments.

Environment Variable
Notes

DIFFBLUE_LICENSE_KEY

The Diffblue license key provided in your welcome email.

DIFFBLUE_OFFLINE_LICENSE_ACTIVATION_FILE_CONTENTS

The contents of the ls_activation.lic offline license file. Note: this is only available for offline Enterprise licenses.

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

DIFFBLUE_HEAD_BRANCH

The git name of the branch that the tests will be written for and committed to.

DIFFBLUE_HEAD_SHA

The SHA of the latest commit in the branch to write tests for.

DIFFBLUE_BASE_BRANCH

The name of the branch the change request (or DIFFBLUE_HEAD_BRANCH) was forked from.

DIFFBLUE_BASE_SHA

The SHA of the latest commit before this branch was forked.

DIFFBLUE_REPOSITORY_URL

The full path to the git remote repository (if not specified, this will be read from the local git configuration).

DIFFBLUE_ACCESS_TOKEN

The git credentials access token. This should give the user permissions to pull and push to the git repository.

DIFFBLUE_ACCESS_TOKEN_NAME

The name of the access token.

DIFFBLUE_COMMIT_AUTHOR

The author name that Diffblue Cover Pipeline will use in the git repository.

DIFFBLUE_COMMIT_EMAIL

The email that Diffblue Cover Pipeline will use in the git repository.

DIFFBLUE_BASELINE_MODE

When set to true this will configure Diffblue Cover two write tests for the whole project, not just changes local to this branch. This is best used when setting up a new project, or with major changes in the code or version of Diffblue Cover.

DIFFBLUE_SKIP_CI

When set to true this will configure Diffblue Cover to exit with a success return code while performing no further actions.

DIFFBLUE_SKIP_PUSH

When set to true this will configure Diffblue Cover to not push changes back to the repository; they will still be committed locally.

Repository Access Configuration

Cover is designed to work with your existing git configuration. This means:

  1. If DIFFBLUE_REPOSITORY_URL is not specified, Cover will use the remote URL from your local git configuration.

  2. If DIFFBLUE_ACCESS_TOKEN and DIFFBLUE_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

  1. When neither DIFFBLUE_HEAD_BRANCH nor DIFFBLUE_HEAD_SHA are specified then Cover will proceed as 2. below assuming that DIFFBLUE_HEAD_BRANCH is the current git branch.

  2. When only DIFFBLUE_HEAD_BRANCH is specified (without DIFFBLUE_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.

  3. When both DIFFBLUE_HEAD_BRANCH and DIFFBLUE_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

  1. 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.

  2. 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.

  3. When both DIFFBLUE_BASE_BRANCH and DIFFBLUE_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.

  4. 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.

Cover will fall back to writing tests for the whole repository as in Baseline mode (see ).

Environment Configuration
Mode Configuration