circleci-cli is a CLI tool for Circle CI.
- List followed projects and filter recent builds by branch.
- Inspect build steps and logs, or watch running builds in real time.
- Summarize a run's workflows and jobs, including uploaded test failures on request.
- Retry or cancel builds and open project or build pages in your browser.
- List and approve pending workflow approval jobs from a run.
- List, set, and delete a project's environment variables.
$ gem install circleci-cliset the CIRCLE_CI_TOKEN environment variable. (optional)
export CIRCLE_CI_TOKEN=your-circle-ci-tokenIn a local checkout of a GitHub project that builds on CircleCI, switch to the branch you want to inspect and run:
circleci-cli buildsEnter your CircleCI API token when prompted if CIRCLE_CI_TOKEN is unset.
The command identifies the project from the GitHub origin remote and shows a table of recent builds on the current branch, including their build numbers and statuses.
See the getting started guide to find a project and inspect a build from any directory.
See the command reference for command options, Git defaults,
and token configuration. Run circleci-cli help COMMAND to see the options
for an individual command.
With CIRCLE_CI_TOKEN set, list your recent runs with the CircleCI API and
copy the id next to the run number you want:
curl -fsS -G 'https://circleci.com/api/v3/runs' \
-H "Authorization: Bearer ${CIRCLE_CI_TOKEN}" \
--data-urlencode 'filter[user_id]=me' | jq -r '.data[] | [.attributes.number, .id] | @tsv'
circleci-cli run 123e4567-e89b-12d3-a456-426614174000On projects supported by build, use the displayed job number to inspect its
steps, for example circleci-cli build -p user/project -n 42.
Use circleci-cli run RUN_ID --failed-tests to include failed tests from jobs
that failed, grouped by workflow and job. Jobs must upload test results with
store_test_results for test details to appear. Each reported failure is
shown in order, including repeats from parallel executions, within the output
limits. Records over 256 KiB are skipped, and the failed-test section is
limited to 1 MiB per run. The section reports when details were omitted.
circleci-cli artifacts RUN_ID
circleci-cli artifacts RUN_ID --download 'screenshots/**/*.png' --destination ./artifactsThe list shows each artifact's workflow, job name, job UUID, execution index,
and path. Downloads require both a path glob and a destination. Quote the glob
to prevent your shell from expanding it. The CLI matches the glob against the
original path returned by the API. Terminal output escapes control characters,
so a path copied from the list may fail to match. If the list shows
report\x61C\x202Efdp.exe, use a wildcard between the visible parts:
circleci-cli artifacts RUN_ID --download 'report*fdp.exe' --destination ./artifactsFiles are saved under DESTINATION/JOB_UUID/EXECUTION/PATH, so parallel
executions can keep the same artifact path. A completed download replaces any
existing file at that path.
Downloads require a POSIX platform with Ruby support for Dir.fchdir.
Artifact listing works without this filesystem support.
circleci-cli approve RUN_ID
circleci-cli approve RUN_ID --job deploy-approvalWithout --job, the command lists pending approval jobs grouped by workflow.
With --job NAME, it approves the pending job with that name; the command
fails if no pending job, or more than one, matches the name.
$ circleci-cli watch
$ circleci-cli watch -v
$ circleci-cli build --last
The retry command requires a CircleCI personal API token and prints the ID of the new workflow.
$ circleci-cli retry --last
$ circleci-cli browse
Bug reports and pull requests are welcome on GitHub at https://github.com/circleci-tools/circleci-cli. See the contributing guide for development setup and checks.
The gem is available as open source under the terms of the MIT License.
Thanks goes to these wonderful people (emoji key):
Yuji Ueki 💻 |
Matt Brictson 💻 |
Fletcher Fowler 🐛 🤔 💻 |
Marco Costa 🤔 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!
