Helper tool for qontract-reconcile development
Project description
Qontract Development CLI
Qontract Development CLI supports your daily qontract-reconcile development work.
Installation
You can install this library from PyPI with pip
:
$ python3 -m pip install qontract-development-cli
Or install it with pipx
:
$ pipx install qontract-development-cli
You can also use pipx
to run the library without installing it:
$ pipx run qontract-development-cli
Quickstart
-
Create initial configuration
$ qd config init
-
Create a profile
sql-query
to run thesql-query
integration$ qd profile create sql-query
-
Run
sql-query
profile$ profile run dev sql-query
Features
Qontract Development CLI currently provides the following features (get help with -h
or --help
):
- Run
qontract-reconcile
andqontract-server
as docker containers on your local machine - Support for different environments (dev, prod, ...) via the
env
command - Configure your qontract-reconcile integration with the
profile
command - Support pull request reviews (see
profile create
) - Bootstrap your initial configurations with the
config
command - Shell autocompletion (see
qd --help
)
Commands
Config
Manage global qontract-development CLI configuration.
qd config [sub-cmd] --help
- edit: open the configuration file in your favorite editor
- init: create a default configuration
Settings
Key | Description | Default |
---|---|---|
debug | Enable/disable debug mode | false |
defaults_profile | Name of defaults profile | defaults |
docker_compose_project_name | Docker compose project name | qontract-development |
editor | Your favorite editor | $EDITOR or vim |
environments_dir | Directory to store environment files | User config directory / environments |
profiles_dir | Directory to store profile files | User config directory / profiles |
worktrees_dir | Directory to store git repo worktrees | User cache directory / worktrees |
Environments
An environment specifies app-interface instance settings, e.g., dev vs. prod config and path to the actual app-interface instance.
qd env [sub-cmd] --help
- edit: Create/edit an environment file in your editor.
- ls: List all available environments.
- rm: Remove environment.
- show: Display environment.
Settings
Key | Description | Default |
---|---|---|
app_interface_path | Path to local app-interface instance | ~/workspace/app-interface |
app_interface_state_bucket | S3 bucket | empty |
app_interface_state_bucket_account | AWS S3 account | empty |
config | app-interface config | ~/workspace/qontract-reconcile/config.dev.toml |
gitlab_pr_submitter_queue_url | Gitlab pr submitter queue url | |
run_qontract_reconcile | Run qontract-reconcile container | true |
run_qontract_server | Run qontract-server container | true |
run_vault | Run vault container | false |
:point_right: Bold keys are mandatory or should be customized.
Profiles
A profile specifies all settings to run a qontract-reconcile integration (e.g., sql-query).
qd profile [sub-cmd] --help
-
create: Create a new profile to run an integration.
Supports the creation of a new profile from an open PR/MR. See
qd profile create --help
for all available options. -
edit: Edit a profile in your editor.
-
ls: List all available profiles.
-
rm: Remove profile.
-
run: Run a profile.
-
show: Display profile.
Settings
Key | Description | Default |
---|---|---|
additional_environment | Dictionary of additional environment variables to pass to the qontract-reconcile container | {} |
container_uid | Change ownership of /recconcile files in container to this user id | current UID |
debugger | Python debugger | debugpy |
dry_run | Run --dry-run mode | true |
integration_name | Intergration name | |
integration_extra_args | Intergration extra arguments | |
log_level | Log level | info |
app_interface_path | App-interface instance path. (Overrides env.app_interface_path) | |
app_interface_pr | App-interface PR/MR number | |
app_interface_upstream | Upstream remote name | upstream |
qontract_reconcile_build_image | Build qontract-reconcile image | true |
qontract_reconcile_image | Qontract-reconcile image | quay.io/app-sre/qontract-reconcile:latest |
qontract_reconcile_path | Qontract-reconcile path | ~/workspace/qontract-reconcile |
qontract_reconcile_pr | Qontract-reconcile PR/MR number | |
qontract_reconcile_upstream | Upstream remote name | upstream |
qontract_server_build_image | Build qontract-server image | true |
qontract_server_image | Qontract-server image | quay.io/app-sre/qontract-server:latest |
qontract_server_path | Qontract-server path | ~/workspace/qontract-server |
qontract_schemas_path | Qontract-schemas path | ~/workspace/qontract-schemas |
qontract_schemas_pr | Qontract-schemas PR/MR number | |
qontract_schemas_upstream | Upstream remote name | upstream |
run_once | If 'true', execute the integration once and exit | true |
sleep_duration_secs | If not run_once, sleep duration until integration runs again | 10 |
:point_right: Bold keys are mandatory or should be customized.
PR/MR support
It's a pretty handy feature to create a profile from a pull request (merge request). E.g.:
$ qd profile create --app-interface PATH_TO_YOUR_LOCAL/app-interface-dev-data --app-interface-pr NUMBER --qontract-schemas-pr NUMBER --qontract-reconcile-pr NUMBER --integration-name glitchtip --integration-extra-args '' glitchtip-pr-check
Which results into this profile:
$ qd profile show glitchtip-pr-check
---
app_interface_path: PATH_TO_YOUR_LOCAL/app-interface-dev-data
app_interface_pr: NUMBER
integration_name: glitchtip
qontract_reconcile_pr: NUMBER
qontract_schemas_pr: NUMBER
Running this profile will:
- Create new git worktrees (see
config.worktrees_dir
) for app-interface-dev-data, qontract-schema, and qontract-reconcile PRs - Start the containers with the adapted path to these worktrees
- Restarting the profile will fetch PR updates
:point_right: A git worktree cleanup isn't implemented yet
Development
Commits
Use Conventional Commit messages. The most important prefixes you should have in mind are:
fix:
which represents bug fixes and correlates to a SemVer patch.feat
represents a new feature and correlates to a SemVer minor.feat!:
, orfix!:
,refactor!:
, etc., which represent a breaking change (indicated by the!
) and will result in a SemVer major.
Release
To release a new version, run:
$ make release
This will:
- Bump the version in
pyproject.toml
- Update the
CHANGELOG.md
- Commit the changes
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for qontract_development_cli-0.8.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9308c5742d5b7e0d58b7d2263a148806799d6fe1478aeb68a6707ea9095a9ade |
|
MD5 | 556b590906dc51cb67fd44a3cdc3f80f |
|
BLAKE2b-256 | 4d8465a1f000e3fb4ab56a106e097a02fab33e39918f43d537bd2fdd3a4085e1 |
Hashes for qontract_development_cli-0.8.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce82d41d4ad2a84db3f136d0eadfb52e4bcd9a8d6d40a9382dd27f20750697b8 |
|
MD5 | a57ffca422ccacc52af227809edfbc30 |
|
BLAKE2b-256 | 941eca8d6a042b1cfce84a7d0311b1df20042be8eff08ca4ddcb3a730b6ce7ea |