CLI Options

All of the ways you can customize your Codecov experience via CLI

Once your CLI Installation is successful, there are additional commands and customizations possible.

📘

Usage

Running codecov-cli --help will output the available commands along with the different general options that can be used with them.

Usage: codecovcli [OPTIONS] COMMAND [ARGS]...

User Inputs

Codecov-cli supports inputs. These inputs, along with their descriptions and usage contexts, are listed in the table below:

InputDescriptionUsage
--auto-load-params-fromThe CI/CD platformOptional
--codecov-yml-pathThe path for your codecov.ymlOptional
--enterprise-urlChange the upload host (Enterprise use)Optional
--versionCodecov-cli's versionOptional
--verbose or -vRun the cli with verbose loggingOptional

Codecov-cli Commands

CommandDescription
create-commitSaves the commit's metadata in codecov, it's only necessary to run this once per commit
create-reportCreates an empty report in codecov with initial data e.g. report name, report's commit
do-uploadSearches for and uploads coverage data to codecov
create-report-resultsUsed for local upload. It tells codecov that you finished local uploading and want it to calculate the results for you to get them locally.
get-report-resultsUsed for local upload. It asks codecov to provide you the report results you calculated with the previous command.
pr-base-pickingTells codecov that you want to explicitly define a base for your PR

Note: Every command has its own different options that will be mentioned later in this doc. Codecov will try to load these options from your CI environment variables, if not, it will try to load them from git, if not found, you may need to add them manually.

create-commit

codecov-cli create-commit [Options]

OptionDescriptionUsage
-C, --sha, --commit-shaCommit SHA (with 40 chars)Required
--parent-shaSHA (with 40 chars) of what should be the parent of this commitOptional
-P, --pr, --pull-request-numberSpecify the pull request number manually. Used to override pre-existing CI environment variablesOptional
-B, --branchBranch to which this commit belongs toOptional
-r, --slugowner/repo slug used instead of the private repo token in Self-hostedRequired
-t, --tokenCodecov upload tokenRequired
--git-serviceGit Provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_serverRequired
--helpShows usage, and command options

create-report

codecov-cli create-report [OPTIONS]

OptionDescriptionUsage
-C, --sha, --commit-shaCommit SHA (with 40 chars)Required
-r, --slugowner/repo slug used instead of the private repo token in Self-hostedRequired
-t, --tokenCodecov upload tokenRequired
--git-serviceGit Provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_serverRequired
--codeThe code of the report. This is used in local uploading to isolate local reports from regular or cloud reports uploaded to codecov so they don't get merged. It's basically a name you give to your report e.g. local-report.Optional
--helpShows usage, and command options

do-upload

codecov-cli do-upload [OPTIONS]

OptionDescriptionUsage
-C, --sha, --commit-shaCommit SHA (with 40 chars)Required
--report-codeThe code of the report defined when creating the report. If unsure, leave defaultOptional
--network-root-folderRoot folder from which to consider paths on the network section default: (Current working directory)Optional
-s, --dir, --coverage-files-search-root-folderFolder where to search for coverage files default: (Current Working Directory)Optional
--exclude, --coverage-files-search-exclude-folderFolders to exclude from searchOptional
-f, --file, --coverage-files-search-direct-fileExplicit files to uploadOptional
-b, --build, --build-codeSpecify the build number manuallyOptional
--build-urlThe URL of the build where this is runningOptional
--job-codeThe job code for the CI runOptional
-t, --tokenCodecov upload tokenRequired
-n, --nameCustom defined name of the upload. Visible in Codecov UIOptional
-B, --branchBranch to which this commit belongs toOptional
-r, --slugowner/repo slugRequired
-P, --pr, --pull-request-numberSpecify the pull request number manually. Used to override pre-existing CI environment variablesOptional
-e, --env, --env-varSpecify environment variables to be included with this build.Optional
-F, --flagFlag the upload to group coverage metrics. Multiple flags allowed.Optional
--pluginplugins to run. Options: xcode, gcov, pycoverage. The default behavior runs them all.Optional
-Z, --fail-on-errorExit with non-zero code in case of error uploading.Optional
-d, --dry-runDon't upload files to CodecovOptional
--legacy, --use-legacy-uploaderUse the legacy upload endpointOptional
--git-serviceGit Provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_serverRequired
--disable-file-fixesDisable file fixes to ignore common lines from coverage (e.g. blank lines or empty brackets)Optional
--helpShows usage, and command options

create-report-results

codecov-cli create-report-results [OPTIONS]

OptionDescriptionUsage
--commit-shaCommit SHA (with 40 chars)Required
--codeThe code of the report. If unsure, leave defaultRequired
--slugowner/repo slugRequired
--git-serviceGit provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_serverOptional
-t, --tokenCodecov upload tokenRequired
--helpShows usage, and command options

get-report-results

codecov-cli get-report-results [OPTIONS]

OptionDescriptionUsage
--commit-shaCommit SHA (with 40 chars)Required
--codeThe code of the report. If unsure, leave defaultRequired
--slugowner/repo slugRequired
--git-serviceGit provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_serverOptional
-t, --tokenCodecov upload tokenRequired
--helpShows usage, and command options

pr-base-picking

codecov-cli pr-base-picking [OPTIONS]

OptionDescriptionUsage
--base-shaBase commit SHA (with 40 chars)Required
--prPull Request id to associate commit withRequired
--slugowner/repo slugRequired
-t, --tokenCodecov upload tokenRequired
--serviceGit provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_serverOptional
--helpShows usage, and command options