A cli for fetching the status and full output of CircleCI jobs.
go install github.com/tmessi/cci/cci@latest
cci
is designed to have sane defaults
if run from within cloned git repository.
It will examine the current branch, and origin remote
to determine which project and branch to use for queries to CircleCI.
Thus to check the status of the current branch, just run:
cci
However,
it does require a CircleCI Token to authenticate the requests.
It is recommended to use the environment variable, CIRCLE_CI_TOKEN
,
along with something like
direnv.
First create a Personal Access Token and add it to your environment:
export CIRCLE_CI_TOKEN=<personal access token>
# no subcommand defaults to status
cci
# If you like typing
cci status
# If you like typing, but not too much
cci s
To see multiple pipeline runs used the --limit|-l
flag:
cci --limit 5
cci -l 5
cci --limit 5 status
cci -l 5 status
cci --limit 5 s
cci -l 5 s
cci output <job number>
cci o <job number>
cci o <workflow name> <job name>
You can then easily pipe the output to other tools:
cci o test build | grep 'FAIL:'
If a job fails for transient reasons, like a network error while installing dependencies, it can be retried:
cci retry <workflow name>
cci r <workflow name>
For more usage information and flags, see the help:
cci --help
For bash
copy the .bash_completion
file to /etc/bash_completion.d/
or to a location that is sourced from ~/.bashrc
or ~/.bash_profile
.
Or add the contents directly to ~/.bashrc
or ~/.bash_profile
.
For other shells, see the
urfave/cli docs.
For example for zsh
follow the description
here.