Skip to main content

This is a small CircleCI CLI that allows you to interact with the CircleCI API v2

Project description

CircleCI CLI

CircleCI

InstallCommandsDevelopmentContributeSupport

🛠 WIP This is a small CircleCI CLI that allows you to interact with the CircleCI API v2.


Install

  1. If you're on macOS, it's recommended you install Python 3 via Homebrew first:

    brew install python3
    
  2. Install cci:

    pip3 install --user cci-cli
    
  3. Open a new shell and type cci --help. You should see help output.

    ⚠️ No output? You might need to update your PATH. On macOS, try adding this to your .zshrc:

    export PATH="$PATH:$HOME/Library/Python/3.9/bin"
    

    (check which version of Python 3 you are using).

  4. Generate a personal CircleCI API token here.

  5. Give this token to cci:

    cci config setup --vcs gh --org lightspeed-hospitality --token <circle-ci-api-token>
    

Install completions

For shell completion, run cci --install-completion zsh (or bash, if you use bash).

⚠️ If you use zsh, the configuration added to the bottom of your .zshrc is wrong and need to be adjusted. Replace:

compinit
zstyle ':completion:*' menu select
fpath+=~/.zfunc

With:

fpath+=~/.zfunc
compinit

Docker

If you don't want to install cci locally, you can run it from Docker:

alias cci='docker pull lightspeedhq-ls-container-dev.jfrog.io/circleci-cli && docker run -it --rm --volume=$HOME/.config/circleci-cli:/root/.config/circleci-cli lightspeedhq-ls-container-dev.jfrog.io/circleci-cli'

Commands

Display your config

cci config show

List the last 20 pipelines for <project-name>

cci pipelines list <project-name>

Trigger a build for <project-name> using <branch>

cci pipelines trigger <project-name> --branch <branch> [--wait-for-result] [--timeout <min>] [--params key=value,...]

Development

Setup

For development, best create a virtual environment and install all dependencies:

python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt

Build

You can create a docker image on your local machine by:

docker build . -t circleci-cli

Run

In order to run the build you created on your local machine, run:

docker run -it --rm --volume=$HOME/.config/circleci-cli:/root/.config/circleci-cli circleci-cli

How to Contribute

In order to contribute you just have to have Python installed on your machine. In case you do not have it installed get it from python.org.

Linting Tool

This project is using pre-commit to enable linting and auto-formatting as a pre-commit hook. The hooks are configured in .pre-commit-config.yaml.

To install the hooks you have to run the following command (only once):

. venv/bin/activate
pre-commit install

Then you can trigger all the hooks manually by running:

. venv/bin/activate
pre-commit run --all-files

Additionally on every git commit the hooks will be triggered and have to pass.

How to run tests

You can run all the tests, by simply running:

. venv/bin/activate
python -m pytest

Support & Feedback

Your contribution is very much appreciated. Feel free to create a PR or an Issue with your suggestions for improvements.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cci-cli-0.1.3.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

cci_cli-0.1.3-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file cci-cli-0.1.3.tar.gz.

File metadata

  • Download URL: cci-cli-0.1.3.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.8.10 Linux/4.15.0-1102-aws

File hashes

Hashes for cci-cli-0.1.3.tar.gz
Algorithm Hash digest
SHA256 522c5a0250568c469bb5ba1c726728940221397ff8c31c9212a63fe45f0efb0b
MD5 493878be04e2d3b184daf92f0261eda8
BLAKE2b-256 74ac340445ed55d77b5c53e91ed40a54ac8c9d4d34ea78a4dec6c925a0f26aa8

See more details on using hashes here.

File details

Details for the file cci_cli-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: cci_cli-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.8.10 Linux/4.15.0-1102-aws

File hashes

Hashes for cci_cli-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3b5fa1e120b1ab2240a8dc3195a2382ddd06d0d8f08d69c975f5d8a90fb2953b
MD5 d865e75b17d5139a8ef874a9cf75af64
BLAKE2b-256 e58c7a57371a2a63ee93278182771a13059aa27f88791becf3c1dfd04463aec8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page