Skip to main content

CLI tool for managing CircleCI contexts and environment vars

Project description

circleci-env-cli

Build Status PyPI version Docker Image Version (latest semver) Docker Pulls

CLI tool for managing CircleCI contexts and environment variables.

Installation

Install via UV (recommended)

uv tool install circleci-env-cli

Install via Pip

pip install circleci-env-cli

Run without installing

uvx circleci-env-cli [OPTIONS]

Install via Docker

docker pull phsmith/circleci-env-cli:[VERSION]

# Run example
docker run --rm -it \
  -v $HOME/project/.env:/env \
  -e CIRCLE_TOKEN=${CIRCLE_TOKEN} \
  phsmith/circleci-env-cli:latest [OPTIONS]

Usage

A CircleCI personal API token must be created before using this tool.

All options can be specified as environment variables in the format: CIRCLE_<OPTION>.

Example: CIRCLE_TOKEN=********

Usage: circleci-env-cli [OPTIONS]

  CLI tool for manage CircleCI contexts and environment vars

Options:
  --version                       Show the version and exit.
  -u, --api-url <circleci_api_url>
                                  [default: https://circleci.com/api]
  -t, --token <circleci_token>    [default: (CIRCLE_TOKEN)]
  -c, --context <context_name>    It will ask for create if does not exists
  -p, --project <project_slug>    Example: github/org-name/project-name
                                  [required]
  -e, --env <environment_var>
  -ef, --env-file <environment_vars_file>
  -l, --list-envs
  -d, --delete                    Delete mode. Behavior depends on other
                                  options:
                                    -c only:      delete the entire context
                                    -c + -e/-ef:  delete specific context vars
                                    -e/-ef only:  delete specific project vars
  -ot, --owner-type <owner_type>  [default: organization]
  --debug
  --help                          Show this message and exit.

Examples

List project environment variables

$ circleci-env-cli -p github/myorg/myproject -l
> Project variables (2):
KEY1
KEY2

Add project environment variables

$ circleci-env-cli -p github/myorg/myproject -e KEY1=VAL1 -e KEY2=VAL2 -ef project.envs.txt
> Successfully added/updated variable: KEY1
> Successfully added/updated variable: KEY2
> Successfully added/updated variable: KEY3
> Successfully added/updated variable: KEY4

The env file (-ef) must contain one KEY=VALUE pair per line:

KEY3=VAL3
KEY4=VAL4

Delete project environment variables

$ circleci-env-cli -p github/myorg/myproject -e KEY1 -e KEY2 -d
> Successfully deleted variable: KEY1
> Successfully deleted variable: KEY2

List context variables

$ circleci-env-cli -p github/myorg/myproject -c mycontext -l
> Context variables (2):
KEY1
KEY2

Create/update context and add variables

$ circleci-env-cli -p github/myorg/myproject -c mycontext -e KEY1=VAL1 -e KEY2=VAL2
The context named "mycontext" was not found. Do you want to create it? [y/n]: y
> Successfully created context: mycontext
> Successfully added/updated context variable: KEY1
> Successfully added/updated context variable: KEY2

Delete context variables

$ circleci-env-cli -p github/myorg/myproject -c mycontext -e KEY1 -e KEY2 -d
> Successfully deleted context variable: KEY1
> Successfully deleted context variable: KEY2

Delete context

$ circleci-env-cli -p github/myorg/myproject -c mycontext -d
Are you sure want to delete the context "mycontext"? [y/n]: y
> Successfully deleted context: mycontext

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

circleci_env_cli-0.3.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

circleci_env_cli-0.3.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file circleci_env_cli-0.3.1.tar.gz.

File metadata

  • Download URL: circleci_env_cli-0.3.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for circleci_env_cli-0.3.1.tar.gz
Algorithm Hash digest
SHA256 0d6e8dcac7f5fc4a23f071e22918178f3f2a24bf0c1adb00ab32e93b6ed88c9f
MD5 370533d093c12a8accbcb2e77e30e995
BLAKE2b-256 2fcf5a8f83fa24caaadd37ee7321895e8de25474f41865ebdd90ff97e87a0bbe

See more details on using hashes here.

File details

Details for the file circleci_env_cli-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: circleci_env_cli-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for circleci_env_cli-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 47fe3aa685533db91a48336329de1d5373fa00fae332e0e9563be811f6b91481
MD5 fd074af4f908662e4cebe281b5861695
BLAKE2b-256 fdfeca660d015b08d591425e73a9c55739bae2ed5500a8a5bfce1436c8b4aa71

See more details on using hashes here.

Supported by

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