@build-tracker/cli

Adding the @build-tracker/cli package includes a command-line utility, bt-cli for interacting with the Build Tracker API. It can be run with yarn bt-cli or npx bt-cli

Important note: Set up the Build Tracker CLI close to your application's code (in the same repository and workspace). Remember that the configuration for the CLI is not the same as the configuration for the server.

Install

yarn add @build-tracker/cli@latest
# or
npm install --save @build-tracker/cli@latest

To list all commands and help, run yarn bt-cli --help

Configuration

The Build Tracker CLI uses the same configuration as the @build-tracker/api-client. For more information, see api-client configuration.

CLI

upload-build

This command will read your configuration file, and upload the current build meta and artifact stats to your server. In most scenarios, this should be all you need.

Beside the arguments below, if you're running your server with a BT_API_AUTH_TOKEN environment variable, ensure you run this command with that variable available as well.

BT_API_AUTH_TOKEN=my-secret-token bt-cli upload-build
option, aliasdescriptiondefault
--branch, -bSet the branch name and do not attempt to read from gitCurrent git working branch
--config, -cSet path to the build-tracker API config fileFound via cosmiconfig
--metaJSON-encoded extra meta information to attach to the build
--parent-revisionManually set the parent revision for the comparison.Determined via git-merge-base
--skip-dirty-checkSkip the git work tree state checkfalse

create-build

This command will create a Build object for the current available build. If run independently, it will only output information, but not upload it anywhere. For that, you only need to run yarn bt-cli upload-build.

option, aliasdescriptiondefault
--branch, -bSet the branch name and do not attempt to read from gitCurrent git working branch
--config, -cSet path to the build-tracker API config fileFound via cosmiconfig
--metaJSON-encoded extra meta information to attach to the build
--out, -oWrite the build to stdouttrue
--parent-revisionManually set the parent revision for the comparison.Determined via git-merge-base
--skip-dirty-checkSkip the git work tree state checkfalse

stat-artifacts

Lower-level than create-build, this command will get artifact stats for the current build files and output a JSON representation of them.

option, aliasdescriptiondefault
--config, -cSet path to the build-tracker API config fileFound via cosmiconfig
--out, -oWrite the stats to stdouttrue

get-build

Retrieve a build by revision

option, aliasdescriptiondefault
--config, -cSet path to the build-tracker API config fileFound via cosmiconfig
--revision, -rGet the build using revision

version

Output the version number of the bt-cli.