Package: qontract-development-cli
Qontract Development CLIQontract Development CLI supports your dailyqontract-reconciledevelopment work.[toc]InstallationYou can install this library fromPyPIwithpip:python3-mpipinstallqontract-development-cliOr install it withpipx:pipxinstallqontract-development-cliYou can also usepipxto run the library without installing it:pipxrunqontract-development-cliQuickstartCreate initial configurationqdconfiginitCreate a profilesql-queryto run thesql-queryintegrationqdprofilecreatesql-queryRunsql-queryprofileqdprofilerundevsql-queryFeaturesQontract Development CLI currently provides the following features (get help with-hor--help):Runqontract-reconcileandqontract-serveras docker containers on your local machineSupport for different App-Interface environments (dev, prod, ...) via theenvcommandConfigure yourqontract-reconcile integrationwith theprofilecommandSupport pull request reviews (seeprofile create)Bootstrap your initial configurations with theconfigcommandShell auto-completion (seeqd --help)Automatically restartqontract-reconcilecontainer when files changeAutomatically rebuild the App-Interface bundle and restart theqontract-servercontainer when files changeExamplesTake a look at theexamplesdirectory for different profile examples.UsageThe following sections describe all available commands and their options.ConfigManage global qontract-development-cli configuration.qd config [sub-cmd] --helpedit: open the configuration file in your favorite editorinit: create a default configurationGlobal SettingsKeyDescriptionDefaultdebugEnable/disable debug modefalsedefaults_profileName of defaults profiledefaultsdocker_compose_project_nameDocker compose project nameqontract-developmenteditorYour favorite editor$EDITOR or vimenvironments_dirDirectory to store environment filesUser config directory / environmentsprofiles_dirDirectory to store profile filesUser config directory / profilesworktrees_dirDirectory to store git repo worktreesUser cache directory / worktreesEnvironmentsAn environment specifies app-interface instance settings, e.g.,devvs.prodconfig and path to the actual app-interface instance.qd env [sub-cmd] --helpedit: Create/edit an environment file in your editor.ls: List all available environments.rm: Remove environment.show: Display environment.Environment SettingsKeyDescriptionDefaultapp_interface_pathPath to local app-interface instance~/workspace/app-interfaceapp_interface_state_bucketS3 bucketemptyapp_interface_state_bucket_accountAWS S3 accountemptyconfigapp-interface config~/workspace/qontract-reconcile/config.dev.tomlgitlab_pr_submitter_queue_urlGitlab pr submitter queue urlrun_qontract_reconcileRun qontract-reconcile containertruerun_qontract_serverRun qontract-server containertruerun_vaultRun vault containerfalse:point_right:Bold keysare mandatory or should be customized.ProfilesA profile specifies all settings to run a qontract-reconcile integration (e.g.,sql-query).qd profile [sub-cmd] --helpcreate: Create a new profile to run an integration.Supports the creation of a new profile from an open PR/MR. See$ qd profile create --helpfor 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.--no-dry-runBy default,qdruns integrations indry-runmode if not explicitly specified differently in the profile config.
There is also a--no-dry-runflag which lets you disabledry-runmode from the command line.qdprofilerundevmy-integration--no-dry-runThe command line flag takes precedence over any configuration you might have in the profile settings.Profile SettingsKeyDescriptionDefaultadditional_environmentDictionary of additional environment variables to pass to the qontract-reconcile container{}container_uidChange ownership of /recconcile files in container to this user idcurrent UIDcommandCommand to run in the qontract-reconcile container.dockerfiles/hack/run-integration.pycommand_extra_argsAdditional arguments to pass to the command.debuggerPython debuggerdebugpydry_runRun --dry-run modetrueextra_hostsList of 'HOSTNAME:IP' mapping entries for qontract-reconcile/etc/hosts. Seeextra_hostsdocker compose file.[]integration_nameIntergration nameintegration_extra_argsIntergration extra argumentsinternal_redhat_caInject Red Hat internal CAs andREQUESTS_CA_BUNDLEenvironment variablefalselog_levelLog levelinfoapp_interface_pathApp-interface instance path. (Overridesenv.app_interface_path)app_interface_prApp-interface PR/MR numberapp_interface_upstreamUpstream remote nameupstreamqontract_reconcile_build_imageBuild qontract-reconcile imagetrueqontract_reconcile_imageQontract-reconcile imagequay.io/app-sre/qontract-reconcile:latestqontract_reconcile_pathQontract-reconcile path~/workspace/qontract-reconcileqontract_reconcile_prQontract-reconcile PR/MR numberqontract_reconcile_upstreamUpstream remote nameupstreamqontract_server_build_imageBuild qontract-server imagetrueqontract_server_imageQontract-server imagequay.io/app-sre/qontract-server:latestqontract_server_pathQontract-server path~/workspace/qontract-serverqontract_schemas_pathQontract-schemas path~/workspace/qontract-schemasqontract_schemas_prQontract-schemas PR/MR numberqontract_schemas_upstreamUpstream remote nameupstreamrun_onceIf 'true', execute the integration once and exittruesleep_duration_secsIf notrun_once, sleep duration until integration runs again10localstackRun localstack container and set AWS related environment variablesfalselocalstack_compose_filePath to your Localstack docker-compose fileqontract_server_path/dev/localstack/docker-compose.yml:point_right:Bold keysare mandatory or should be customized.PR/MR supportIt's a pretty handy feature to create a profile from a pull request (merge request). E.g.:qdprofilecreate--app-interfacePATH_TO_YOUR_LOCAL/app-interface-dev-data--app-interface-prNUMBER--qontract-schemas-prNUMBER--qontract-reconcile-prNUMBER--integration-nameglitchtip--integration-extra-args''glitchtip-pr-checkWhich results in this profile:$qdprofileshowglitchtip-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:NUMBERRunning this profile will:Create new git worktrees (seeconfig.worktrees_dir) for app-interface-dev-data, qontract-schema, and qontract-reconcile PRsStart the containers with the adapted path to these worktreesRestarting the profile will fetch PR updates:point_right: A git worktree cleanup isn't implemented yetDevelopmentReleaseBump the version inpyproject.tomlUpdate theCHANGELOG.mdCommit the changes