qontract-development-cli 0.13.2__tar.gz → 0.14.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {qontract_development_cli-0.13.2 → qontract_development_cli-0.14.0}/PKG-INFO +82 -76
  2. {qontract_development_cli-0.13.2 → qontract_development_cli-0.14.0}/README.md +76 -67
  3. {qontract_development_cli-0.13.2 → qontract_development_cli-0.14.0}/pyproject.toml +36 -18
  4. {qontract_development_cli-0.13.2 → qontract_development_cli-0.14.0}/qontract_development_cli/commands/config.py +1 -1
  5. {qontract_development_cli-0.13.2 → qontract_development_cli-0.14.0}/qontract_development_cli/commands/env.py +3 -3
  6. {qontract_development_cli-0.13.2 → qontract_development_cli-0.14.0}/qontract_development_cli/commands/profile.py +16 -14
  7. {qontract_development_cli-0.13.2 → qontract_development_cli-0.14.0}/qontract_development_cli/models.py +14 -1
  8. {qontract_development_cli-0.13.2 → qontract_development_cli-0.14.0}/qontract_development_cli/shell.py +30 -32
  9. qontract_development_cli-0.14.0/qontract_development_cli/templates/compose.override.yml.j2 +7 -0
  10. {qontract_development_cli-0.13.2 → qontract_development_cli-0.14.0}/qontract_development_cli/templates/compose.yml.j2 +13 -0
  11. qontract_development_cli-0.14.0/setup.py +41 -0
  12. qontract_development_cli-0.13.2/LICENSE +0 -21
  13. qontract_development_cli-0.13.2/setup.py +0 -42
  14. {qontract_development_cli-0.13.2 → qontract_development_cli-0.14.0}/qontract_development_cli/__init__.py +0 -0
  15. {qontract_development_cli-0.13.2 → qontract_development_cli-0.14.0}/qontract_development_cli/__main__.py +0 -0
  16. {qontract_development_cli-0.13.2 → qontract_development_cli-0.14.0}/qontract_development_cli/cli.py +0 -0
  17. {qontract_development_cli-0.13.2 → qontract_development_cli-0.14.0}/qontract_development_cli/commands/__init__.py +0 -0
  18. {qontract_development_cli-0.13.2 → qontract_development_cli-0.14.0}/qontract_development_cli/completions.py +0 -0
  19. {qontract_development_cli-0.13.2 → qontract_development_cli-0.14.0}/qontract_development_cli/config.py +0 -0
  20. {qontract_development_cli-0.13.2 → qontract_development_cli-0.14.0}/qontract_development_cli/templates/prep-worktree.sh.j2 +0 -0
  21. {qontract_development_cli-0.13.2 → qontract_development_cli-0.14.0}/qontract_development_cli/templates.py +0 -0
  22. {qontract_development_cli-0.13.2 → qontract_development_cli-0.14.0}/qontract_development_cli/utils.py +0 -0
  23. {qontract_development_cli-0.13.2 → qontract_development_cli-0.14.0}/qontract_development_cli/watchdog.py +0 -0
@@ -1,26 +1,23 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qontract-development-cli
3
- Version: 0.13.2
3
+ Version: 0.14.0
4
4
  Summary: Helper tool for qontract-reconcile development
5
5
  Home-page: http://github.com/chassing/qontract-development-cli
6
6
  License: MIT
7
7
  Author: Christian Assing
8
8
  Author-email: cassing@redhat.com
9
- Requires-Python: >=3.9,<4.0
9
+ Requires-Python: >=3.11,<4.0
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.9
13
- Classifier: Programming Language :: Python :: 3.10
14
12
  Classifier: Programming Language :: Python :: 3.11
15
13
  Requires-Dist: Jinja2 (>=3.1.2,<4.0.0)
16
- Requires-Dist: PyYAML (>=6.0,<7.0)
14
+ Requires-Dist: PyYAML (>=6.0.1,<7.0.0)
17
15
  Requires-Dist: appdirs (>=1.4.4,<2.0.0)
18
16
  Requires-Dist: getkey (>=0.6.5,<0.7.0)
19
17
  Requires-Dist: pydantic (>=1.10.2,<2.0.0)
20
- Requires-Dist: rich (>=12.5.1,<13.0.0)
21
- Requires-Dist: textual (>=0.2.1,<0.3.0)
22
- Requires-Dist: typer (>=0.6.1,<0.7.0)
23
- Requires-Dist: watchfiles (>=0.18.0,<0.19.0)
18
+ Requires-Dist: rich (>=13.7.0,<14.0.0)
19
+ Requires-Dist: typer (>=0.9.0,<0.10.0)
20
+ Requires-Dist: watchfiles (>=0.21.0,<0.22.0)
24
21
  Project-URL: Repository, http://github.com/chassing/qontract-development-cli
25
22
  Description-Content-Type: text/markdown
26
23
 
@@ -29,61 +26,69 @@ Description-Content-Type: text/markdown
29
26
  [![PyPI](https://img.shields.io/pypi/v/qontract-development-cli)][pypi-link]
30
27
  [![PyPI platforms][pypi-platforms]][pypi-link]
31
28
  ![PyPI - License](https://img.shields.io/pypi/l/qontract-development-cli)
32
- [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
33
29
 
34
30
  Qontract Development CLI supports your daily [qontract-reconcile][qontract-reconcile] development work.
35
31
 
32
+ [toc]
33
+
36
34
  ## Installation
37
35
 
38
36
  You can install this library from [PyPI][pypi-link] with `pip`:
39
37
 
40
38
  ```shell
41
- $ python3 -m pip install qontract-development-cli
39
+ python3 -m pip install qontract-development-cli
42
40
  ```
43
41
 
44
42
  Or install it with `pipx`:
43
+
45
44
  ```shell
46
- $ pipx install qontract-development-cli
45
+ pipx install qontract-development-cli
47
46
  ```
48
47
 
49
48
  You can also use `pipx` to run the library without installing it:
50
49
 
51
50
  ```shell
52
- $ pipx run qontract-development-cli
51
+ pipx run qontract-development-cli
53
52
  ```
54
53
 
55
54
  ## Quickstart
56
55
 
57
56
  * Create initial configuration
57
+
58
58
  ```shell
59
- $ qd config init
59
+ qd config init
60
60
  ```
61
- <img src="demo/qd_config_init.gif" />
61
+
62
+ ![qd init](/demo/qd_config_init.gif)
62
63
 
63
64
  * Create a profile `sql-query` to run the `sql-query` integration
65
+
64
66
  ```shell
65
- $ qd profile create sql-query
67
+ qd profile create sql-query
66
68
  ```
67
- <img src="demo/qd_profile_create.gif" />
69
+
70
+ ![qd profile create](/demo/qd_profile_create.gif)
68
71
 
69
72
  * Run `sql-query` profile
73
+
70
74
  ```shell
71
- $ profile run dev sql-query
75
+ qd profile run dev sql-query
72
76
  ```
73
- <img src="images/profile_run_sql_query.svg" />
77
+
78
+ ![qd sql_query](/images/profile_run_sql_query.svg)
74
79
 
75
80
  ## Features
76
81
 
77
82
  Qontract Development CLI currently provides the following features (get help with `-h` or `--help`):
78
83
 
79
- - Run `qontract-reconcile` and `qontract-server` as docker containers on your local machine
80
- - Support for different App-Interface environments (dev, prod, ...) via the `env` command
81
- - Configure your [qontract-reconcile integration][qontract-reconcile] with the `profile` command
82
- - Support pull request reviews (see `profile create`)
83
- - Bootstrap your initial configurations with the `config` command
84
- - Shell auto-completion (see `qd --help`)
85
- - Automatically restart `qontract-reconcile` container when files change
86
- - Automatically rebuild the App-Interface bundle and restart the `qontract-server` container when files change
84
+ * Run `qontract-reconcile` and `qontract-server` as docker containers on your local machine
85
+ * Support for different App-Interface environments (dev, prod, ...) via the `env` command
86
+ * Configure your [qontract-reconcile integration][qontract-reconcile] with the `profile` command
87
+ * Support pull request reviews (see `profile create`)
88
+ * Bootstrap your initial configurations with the `config` command
89
+ * Shell auto-completion (see `qd --help`)
90
+ * Automatically restart `qontract-reconcile` container when files change
91
+ * Automatically rebuild the App-Interface bundle and restart the `qontract-server` container when files change
87
92
 
88
93
  ## Examples
89
94
 
@@ -97,12 +102,13 @@ The following sections describe all available commands and their options.
97
102
 
98
103
  Manage global qontract-development-cli configuration.
99
104
 
100
- `$ qd config [sub-cmd] --help`
105
+ `qd config [sub-cmd] --help`
101
106
 
102
107
  * **edit**: open the configuration file in your favorite editor
103
108
  * **init**: create a default configuration
104
109
 
105
- #### Settings
110
+ #### Global Settings
111
+
106
112
  | **Key** | **Description** | **Default** |
107
113
  | --------------------------- | ------------------------------------- | ------------------------------------ |
108
114
  | debug | Enable/disable debug mode | false |
@@ -113,19 +119,18 @@ Manage global qontract-development-cli configuration.
113
119
  | profiles_dir | Directory to store profile files | User config directory / profiles |
114
120
  | worktrees_dir | Directory to store git repo worktrees | User cache directory / worktrees |
115
121
 
116
- ## Environments
122
+ ### Environments
117
123
 
118
124
  An environment specifies app-interface instance settings, e.g., **dev** vs. **prod** config and path to the actual app-interface instance.
119
125
 
120
- `$ qd env [sub-cmd] --help`
126
+ `qd env [sub-cmd] --help`
121
127
 
122
128
  * **edit**: Create/edit an environment file in your editor.
123
129
  * **ls**: List all available environments.
124
130
  * **rm**: Remove environment.
125
131
  * **show**: Display environment.
126
132
 
127
-
128
- #### Settings
133
+ #### Environment Settings
129
134
 
130
135
  | **Key** | **Description** | **Default** |
131
136
  | ---------------------------------- | ------------------------------------ | ---------------------------------------------- |
@@ -140,11 +145,11 @@ An environment specifies app-interface instance settings, e.g., **dev** vs. **pr
140
145
 
141
146
  > :point_right: **Bold keys** are mandatory or should be customized.
142
147
 
143
- ## Profiles
148
+ ### Profiles
144
149
 
145
150
  A profile specifies all settings to run a qontract-reconcile integration (e.g., *sql-query*).
146
151
 
147
- `$ qd profile [sub-cmd] --help`
152
+ `qd profile [sub-cmd] --help`
148
153
 
149
154
  * **create**: Create a new profile to run an integration.
150
155
 
@@ -156,48 +161,50 @@ A profile specifies all settings to run a qontract-reconcile integration (e.g.,
156
161
  * **run**: Run a profile.
157
162
  * **show**: Display profile.
158
163
 
159
- ### --no-dry-run
164
+ #### --no-dry-run
160
165
 
161
- By default `qd` runs integrations in `dry-run` mode if not explicitly specified differently in the profile config.
162
- There is also a `--no-dry-run` flag which lets you disable `dry-run` mode from command line.
166
+ By default, `qd` runs integrations in `dry-run` mode if not explicitly specified differently in the profile config.
167
+ There is also a `--no-dry-run` flag which lets you disable `dry-run` mode from the command line.
163
168
 
164
- ```
165
- $ qd profile run dev my-integration --no-dry-run
169
+ ```shell
170
+ qd profile run dev my-integration --no-dry-run
166
171
  ```
167
172
 
168
173
  The command line flag takes precedence over any configuration you might have in the profile settings.
169
174
 
170
- #### Settings
171
-
172
- | **Key** | **Description** | **Default** |
173
- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
174
- | additional_environment | Dictionary of additional environment variables to pass to the qontract-reconcile container | `{}` |
175
- | container_uid | Change ownership of /recconcile files in container to this user id | current UID |
176
- | command | Command to run in the qontract-reconcile container. | `dockerfiles/hack/run-integration.py` |
177
- | command_extra_args | Additional arguments to pass to the command. | |
178
- | debugger | Python debugger | `debugpy` |
179
- | dry_run | Run --dry-run mode | `true` |
180
- | extra_hosts | List of 'HOSTNAME:IP' mapping entries for qontract-reconcile `/etc/hosts`. See [extra_hosts](https://docs.docker.com/compose/compose-file/#extra_hosts) docker compose file. | `[]` |
181
- | **integration_name** | Intergration name | |
182
- | **integration_extra_args** | Intergration extra arguments | |
183
- | **internal_redhat_ca** | Inject Red Hat internal CAs and `REQUESTS_CA_BUNDLE` environment variable | `false` |
184
- | log_level | Log level | `info` |
185
- | app_interface_path | App-interface instance path. (Overrides *env.app_interface_path*) | |
186
- | app_interface_pr | App-interface PR/MR number | |
187
- | app_interface_upstream | Upstream remote name | `upstream` |
188
- | qontract_reconcile_build_image | Build qontract-reconcile image | `true` |
189
- | qontract_reconcile_image | Qontract-reconcile image | `quay.io/app-sre/qontract-reconcile:latest` |
190
- | qontract_reconcile_path | Qontract-reconcile path | `~/workspace/qontract-reconcile` |
191
- | qontract_reconcile_pr | Qontract-reconcile PR/MR number | |
192
- | qontract_reconcile_upstream | Upstream remote name | `upstream` |
193
- | qontract_server_build_image | Build qontract-server image | `true` |
194
- | qontract_server_image | Qontract-server image | `quay.io/app-sre/qontract-server:lates`t |
195
- | qontract_server_path | Qontract-server path | `~/workspace/qontract-server` |
196
- | qontract_schemas_path | Qontract-schemas path | `~/workspace/qontract-schemas` |
197
- | qontract_schemas_pr | Qontract-schemas PR/MR number | |
198
- | qontract_schemas_upstream | Upstream remote name | `upstream` |
199
- | run_once | If 'true', execute the integration once and exit | `true` |
200
- | sleep_duration_secs | If not *run_once*, sleep duration until integration runs again | `10` |
175
+ #### Profile Settings
176
+
177
+ | **Key** | **Description** | **Default** |
178
+ | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
179
+ | additional_environment | Dictionary of additional environment variables to pass to the qontract-reconcile container | `{}` |
180
+ | container_uid | Change ownership of /recconcile files in container to this user id | current UID |
181
+ | command | Command to run in the qontract-reconcile container. | `dockerfiles/hack/run-integration.py` |
182
+ | command_extra_args | Additional arguments to pass to the command. | |
183
+ | debugger | Python debugger | `debugpy` |
184
+ | dry_run | Run --dry-run mode | `true` |
185
+ | extra_hosts | List of 'HOSTNAME:IP' mapping entries for qontract-reconcile `/etc/hosts`. See [extra_hosts](https://docs.docker.com/compose/compose-file/#extra_hosts) docker compose file. | `[]` |
186
+ | **integration_name** | Intergration name | |
187
+ | **integration_extra_args** | Intergration extra arguments | |
188
+ | **internal_redhat_ca** | Inject Red Hat internal CAs and `REQUESTS_CA_BUNDLE` environment variable | `false` |
189
+ | log_level | Log level | `info` |
190
+ | app_interface_path | App-interface instance path. (Overrides *env.app_interface_path*) | |
191
+ | app_interface_pr | App-interface PR/MR number | |
192
+ | app_interface_upstream | Upstream remote name | `upstream` |
193
+ | qontract_reconcile_build_image | Build qontract-reconcile image | `true` |
194
+ | qontract_reconcile_image | Qontract-reconcile image | `quay.io/app-sre/qontract-reconcile:latest` |
195
+ | qontract_reconcile_path | Qontract-reconcile path | `~/workspace/qontract-reconcile` |
196
+ | qontract_reconcile_pr | Qontract-reconcile PR/MR number | |
197
+ | qontract_reconcile_upstream | Upstream remote name | `upstream` |
198
+ | qontract_server_build_image | Build qontract-server image | `true` |
199
+ | qontract_server_image | Qontract-server image | `quay.io/app-sre/qontract-server:lates`t |
200
+ | qontract_server_path | Qontract-server path | `~/workspace/qontract-server` |
201
+ | qontract_schemas_path | Qontract-schemas path | `~/workspace/qontract-schemas` |
202
+ | qontract_schemas_pr | Qontract-schemas PR/MR number | |
203
+ | qontract_schemas_upstream | Upstream remote name | `upstream` |
204
+ | run_once | If 'true', execute the integration once and exit | `true` |
205
+ | sleep_duration_secs | If not *run_once*, sleep duration until integration runs again | `10` |
206
+ | localstack | Run localstack container and set AWS related environment variables | `false` |
207
+ | localstack_compose_file | Path to your Localstack docker-compose file | `qontract_server_path` / `dev/localstack/docker-compose.yml` |
201
208
 
202
209
  > :point_right: **Bold keys** are mandatory or should be customized.
203
210
 
@@ -206,7 +213,7 @@ The command line flag takes precedence over any configuration you might have in
206
213
  It's a pretty handy feature to create a profile from a pull request (merge request). E.g.:
207
214
 
208
215
  ```shell
209
- $ 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
216
+ 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
210
217
  ```
211
218
 
212
219
  Which results in this profile:
@@ -222,6 +229,7 @@ qontract_schemas_pr: NUMBER
222
229
  ```
223
230
 
224
231
  Running this profile will:
232
+
225
233
  * Create new git worktrees (see `config.worktrees_dir`) for app-interface-dev-data, qontract-schema, and qontract-reconcile PRs
226
234
  * Start the containers with the adapted path to these worktrees
227
235
  * Restarting the profile will fetch PR updates
@@ -230,8 +238,8 @@ Running this profile will:
230
238
 
231
239
  ## Development
232
240
 
233
- [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
234
- [![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
241
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
242
+ [![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
235
243
 
236
244
  ### Release
237
245
 
@@ -239,9 +247,7 @@ Running this profile will:
239
247
  * Update the `CHANGELOG.md`
240
248
  * Commit the changes
241
249
 
242
-
243
250
  [pypi-link]: https://pypi.org/project/qontract-development-cli/
244
251
  [pypi-platforms]: https://img.shields.io/pypi/pyversions/qontract-development-cli
245
- [pypi-version]: https://badge.fury.io/py/qontract-development-cli.svg
246
252
  [qontract-reconcile]: https://github.com/app-sre/qontract-reconcile
247
253
 
@@ -3,61 +3,69 @@
3
3
  [![PyPI](https://img.shields.io/pypi/v/qontract-development-cli)][pypi-link]
4
4
  [![PyPI platforms][pypi-platforms]][pypi-link]
5
5
  ![PyPI - License](https://img.shields.io/pypi/l/qontract-development-cli)
6
- [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
7
6
 
8
7
  Qontract Development CLI supports your daily [qontract-reconcile][qontract-reconcile] development work.
9
8
 
9
+ [toc]
10
+
10
11
  ## Installation
11
12
 
12
13
  You can install this library from [PyPI][pypi-link] with `pip`:
13
14
 
14
15
  ```shell
15
- $ python3 -m pip install qontract-development-cli
16
+ python3 -m pip install qontract-development-cli
16
17
  ```
17
18
 
18
19
  Or install it with `pipx`:
20
+
19
21
  ```shell
20
- $ pipx install qontract-development-cli
22
+ pipx install qontract-development-cli
21
23
  ```
22
24
 
23
25
  You can also use `pipx` to run the library without installing it:
24
26
 
25
27
  ```shell
26
- $ pipx run qontract-development-cli
28
+ pipx run qontract-development-cli
27
29
  ```
28
30
 
29
31
  ## Quickstart
30
32
 
31
33
  * Create initial configuration
34
+
32
35
  ```shell
33
- $ qd config init
36
+ qd config init
34
37
  ```
35
- <img src="demo/qd_config_init.gif" />
38
+
39
+ ![qd init](/demo/qd_config_init.gif)
36
40
 
37
41
  * Create a profile `sql-query` to run the `sql-query` integration
42
+
38
43
  ```shell
39
- $ qd profile create sql-query
44
+ qd profile create sql-query
40
45
  ```
41
- <img src="demo/qd_profile_create.gif" />
46
+
47
+ ![qd profile create](/demo/qd_profile_create.gif)
42
48
 
43
49
  * Run `sql-query` profile
50
+
44
51
  ```shell
45
- $ profile run dev sql-query
52
+ qd profile run dev sql-query
46
53
  ```
47
- <img src="images/profile_run_sql_query.svg" />
54
+
55
+ ![qd sql_query](/images/profile_run_sql_query.svg)
48
56
 
49
57
  ## Features
50
58
 
51
59
  Qontract Development CLI currently provides the following features (get help with `-h` or `--help`):
52
60
 
53
- - Run `qontract-reconcile` and `qontract-server` as docker containers on your local machine
54
- - Support for different App-Interface environments (dev, prod, ...) via the `env` command
55
- - Configure your [qontract-reconcile integration][qontract-reconcile] with the `profile` command
56
- - Support pull request reviews (see `profile create`)
57
- - Bootstrap your initial configurations with the `config` command
58
- - Shell auto-completion (see `qd --help`)
59
- - Automatically restart `qontract-reconcile` container when files change
60
- - Automatically rebuild the App-Interface bundle and restart the `qontract-server` container when files change
61
+ * Run `qontract-reconcile` and `qontract-server` as docker containers on your local machine
62
+ * Support for different App-Interface environments (dev, prod, ...) via the `env` command
63
+ * Configure your [qontract-reconcile integration][qontract-reconcile] with the `profile` command
64
+ * Support pull request reviews (see `profile create`)
65
+ * Bootstrap your initial configurations with the `config` command
66
+ * Shell auto-completion (see `qd --help`)
67
+ * Automatically restart `qontract-reconcile` container when files change
68
+ * Automatically rebuild the App-Interface bundle and restart the `qontract-server` container when files change
61
69
 
62
70
  ## Examples
63
71
 
@@ -71,12 +79,13 @@ The following sections describe all available commands and their options.
71
79
 
72
80
  Manage global qontract-development-cli configuration.
73
81
 
74
- `$ qd config [sub-cmd] --help`
82
+ `qd config [sub-cmd] --help`
75
83
 
76
84
  * **edit**: open the configuration file in your favorite editor
77
85
  * **init**: create a default configuration
78
86
 
79
- #### Settings
87
+ #### Global Settings
88
+
80
89
  | **Key** | **Description** | **Default** |
81
90
  | --------------------------- | ------------------------------------- | ------------------------------------ |
82
91
  | debug | Enable/disable debug mode | false |
@@ -87,19 +96,18 @@ Manage global qontract-development-cli configuration.
87
96
  | profiles_dir | Directory to store profile files | User config directory / profiles |
88
97
  | worktrees_dir | Directory to store git repo worktrees | User cache directory / worktrees |
89
98
 
90
- ## Environments
99
+ ### Environments
91
100
 
92
101
  An environment specifies app-interface instance settings, e.g., **dev** vs. **prod** config and path to the actual app-interface instance.
93
102
 
94
- `$ qd env [sub-cmd] --help`
103
+ `qd env [sub-cmd] --help`
95
104
 
96
105
  * **edit**: Create/edit an environment file in your editor.
97
106
  * **ls**: List all available environments.
98
107
  * **rm**: Remove environment.
99
108
  * **show**: Display environment.
100
109
 
101
-
102
- #### Settings
110
+ #### Environment Settings
103
111
 
104
112
  | **Key** | **Description** | **Default** |
105
113
  | ---------------------------------- | ------------------------------------ | ---------------------------------------------- |
@@ -114,11 +122,11 @@ An environment specifies app-interface instance settings, e.g., **dev** vs. **pr
114
122
 
115
123
  > :point_right: **Bold keys** are mandatory or should be customized.
116
124
 
117
- ## Profiles
125
+ ### Profiles
118
126
 
119
127
  A profile specifies all settings to run a qontract-reconcile integration (e.g., *sql-query*).
120
128
 
121
- `$ qd profile [sub-cmd] --help`
129
+ `qd profile [sub-cmd] --help`
122
130
 
123
131
  * **create**: Create a new profile to run an integration.
124
132
 
@@ -130,48 +138,50 @@ A profile specifies all settings to run a qontract-reconcile integration (e.g.,
130
138
  * **run**: Run a profile.
131
139
  * **show**: Display profile.
132
140
 
133
- ### --no-dry-run
141
+ #### --no-dry-run
134
142
 
135
- By default `qd` runs integrations in `dry-run` mode if not explicitly specified differently in the profile config.
136
- There is also a `--no-dry-run` flag which lets you disable `dry-run` mode from command line.
143
+ By default, `qd` runs integrations in `dry-run` mode if not explicitly specified differently in the profile config.
144
+ There is also a `--no-dry-run` flag which lets you disable `dry-run` mode from the command line.
137
145
 
138
- ```
139
- $ qd profile run dev my-integration --no-dry-run
146
+ ```shell
147
+ qd profile run dev my-integration --no-dry-run
140
148
  ```
141
149
 
142
150
  The command line flag takes precedence over any configuration you might have in the profile settings.
143
151
 
144
- #### Settings
145
-
146
- | **Key** | **Description** | **Default** |
147
- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
148
- | additional_environment | Dictionary of additional environment variables to pass to the qontract-reconcile container | `{}` |
149
- | container_uid | Change ownership of /recconcile files in container to this user id | current UID |
150
- | command | Command to run in the qontract-reconcile container. | `dockerfiles/hack/run-integration.py` |
151
- | command_extra_args | Additional arguments to pass to the command. | |
152
- | debugger | Python debugger | `debugpy` |
153
- | dry_run | Run --dry-run mode | `true` |
154
- | extra_hosts | List of 'HOSTNAME:IP' mapping entries for qontract-reconcile `/etc/hosts`. See [extra_hosts](https://docs.docker.com/compose/compose-file/#extra_hosts) docker compose file. | `[]` |
155
- | **integration_name** | Intergration name | |
156
- | **integration_extra_args** | Intergration extra arguments | |
157
- | **internal_redhat_ca** | Inject Red Hat internal CAs and `REQUESTS_CA_BUNDLE` environment variable | `false` |
158
- | log_level | Log level | `info` |
159
- | app_interface_path | App-interface instance path. (Overrides *env.app_interface_path*) | |
160
- | app_interface_pr | App-interface PR/MR number | |
161
- | app_interface_upstream | Upstream remote name | `upstream` |
162
- | qontract_reconcile_build_image | Build qontract-reconcile image | `true` |
163
- | qontract_reconcile_image | Qontract-reconcile image | `quay.io/app-sre/qontract-reconcile:latest` |
164
- | qontract_reconcile_path | Qontract-reconcile path | `~/workspace/qontract-reconcile` |
165
- | qontract_reconcile_pr | Qontract-reconcile PR/MR number | |
166
- | qontract_reconcile_upstream | Upstream remote name | `upstream` |
167
- | qontract_server_build_image | Build qontract-server image | `true` |
168
- | qontract_server_image | Qontract-server image | `quay.io/app-sre/qontract-server:lates`t |
169
- | qontract_server_path | Qontract-server path | `~/workspace/qontract-server` |
170
- | qontract_schemas_path | Qontract-schemas path | `~/workspace/qontract-schemas` |
171
- | qontract_schemas_pr | Qontract-schemas PR/MR number | |
172
- | qontract_schemas_upstream | Upstream remote name | `upstream` |
173
- | run_once | If 'true', execute the integration once and exit | `true` |
174
- | sleep_duration_secs | If not *run_once*, sleep duration until integration runs again | `10` |
152
+ #### Profile Settings
153
+
154
+ | **Key** | **Description** | **Default** |
155
+ | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
156
+ | additional_environment | Dictionary of additional environment variables to pass to the qontract-reconcile container | `{}` |
157
+ | container_uid | Change ownership of /recconcile files in container to this user id | current UID |
158
+ | command | Command to run in the qontract-reconcile container. | `dockerfiles/hack/run-integration.py` |
159
+ | command_extra_args | Additional arguments to pass to the command. | |
160
+ | debugger | Python debugger | `debugpy` |
161
+ | dry_run | Run --dry-run mode | `true` |
162
+ | extra_hosts | List of 'HOSTNAME:IP' mapping entries for qontract-reconcile `/etc/hosts`. See [extra_hosts](https://docs.docker.com/compose/compose-file/#extra_hosts) docker compose file. | `[]` |
163
+ | **integration_name** | Intergration name | |
164
+ | **integration_extra_args** | Intergration extra arguments | |
165
+ | **internal_redhat_ca** | Inject Red Hat internal CAs and `REQUESTS_CA_BUNDLE` environment variable | `false` |
166
+ | log_level | Log level | `info` |
167
+ | app_interface_path | App-interface instance path. (Overrides *env.app_interface_path*) | |
168
+ | app_interface_pr | App-interface PR/MR number | |
169
+ | app_interface_upstream | Upstream remote name | `upstream` |
170
+ | qontract_reconcile_build_image | Build qontract-reconcile image | `true` |
171
+ | qontract_reconcile_image | Qontract-reconcile image | `quay.io/app-sre/qontract-reconcile:latest` |
172
+ | qontract_reconcile_path | Qontract-reconcile path | `~/workspace/qontract-reconcile` |
173
+ | qontract_reconcile_pr | Qontract-reconcile PR/MR number | |
174
+ | qontract_reconcile_upstream | Upstream remote name | `upstream` |
175
+ | qontract_server_build_image | Build qontract-server image | `true` |
176
+ | qontract_server_image | Qontract-server image | `quay.io/app-sre/qontract-server:lates`t |
177
+ | qontract_server_path | Qontract-server path | `~/workspace/qontract-server` |
178
+ | qontract_schemas_path | Qontract-schemas path | `~/workspace/qontract-schemas` |
179
+ | qontract_schemas_pr | Qontract-schemas PR/MR number | |
180
+ | qontract_schemas_upstream | Upstream remote name | `upstream` |
181
+ | run_once | If 'true', execute the integration once and exit | `true` |
182
+ | sleep_duration_secs | If not *run_once*, sleep duration until integration runs again | `10` |
183
+ | localstack | Run localstack container and set AWS related environment variables | `false` |
184
+ | localstack_compose_file | Path to your Localstack docker-compose file | `qontract_server_path` / `dev/localstack/docker-compose.yml` |
175
185
 
176
186
  > :point_right: **Bold keys** are mandatory or should be customized.
177
187
 
@@ -180,7 +190,7 @@ The command line flag takes precedence over any configuration you might have in
180
190
  It's a pretty handy feature to create a profile from a pull request (merge request). E.g.:
181
191
 
182
192
  ```shell
183
- $ 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
193
+ 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
184
194
  ```
185
195
 
186
196
  Which results in this profile:
@@ -196,6 +206,7 @@ qontract_schemas_pr: NUMBER
196
206
  ```
197
207
 
198
208
  Running this profile will:
209
+
199
210
  * Create new git worktrees (see `config.worktrees_dir`) for app-interface-dev-data, qontract-schema, and qontract-reconcile PRs
200
211
  * Start the containers with the adapted path to these worktrees
201
212
  * Restarting the profile will fetch PR updates
@@ -204,8 +215,8 @@ Running this profile will:
204
215
 
205
216
  ## Development
206
217
 
207
- [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
208
- [![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
218
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
219
+ [![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
209
220
 
210
221
  ### Release
211
222
 
@@ -213,8 +224,6 @@ Running this profile will:
213
224
  * Update the `CHANGELOG.md`
214
225
  * Commit the changes
215
226
 
216
-
217
227
  [pypi-link]: https://pypi.org/project/qontract-development-cli/
218
228
  [pypi-platforms]: https://img.shields.io/pypi/pyversions/qontract-development-cli
219
- [pypi-version]: https://badge.fury.io/py/qontract-development-cli.svg
220
229
  [qontract-reconcile]: https://github.com/app-sre/qontract-reconcile
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "qontract-development-cli"
3
- version = "0.13.2"
3
+ version = "0.14.0"
4
4
  description = "Helper tool for qontract-reconcile development"
5
5
  authors = ["Christian Assing <cassing@redhat.com>"]
6
6
  license = "MIT"
@@ -9,27 +9,24 @@ repository = "http://github.com/chassing/qontract-development-cli"
9
9
  homepage = "http://github.com/chassing/qontract-development-cli"
10
10
 
11
11
  [tool.poetry.dependencies]
12
- python = ">=3.9,<4.0"
12
+ python = ">=3.11,<4.0"
13
13
  Jinja2 = "^3.1.2"
14
- typer = "^0.6.1"
15
- rich = "^12.5.1"
14
+ typer = "^0.9.0"
15
+ rich = "^13.7.0"
16
16
  pydantic = "^1.10.2"
17
17
  appdirs = "^1.4.4"
18
- PyYAML = "^6.0"
18
+ PyYAML = "^6.0.1"
19
19
  getkey = "^0.6.5"
20
- watchfiles = "^0.18.0"
21
- textual = "^0.2.1"
20
+ watchfiles = "^0.21.0"
22
21
 
23
22
  [tool.poetry.dev-dependencies]
24
23
  types-PyYAML = "^6.0.12"
25
24
 
26
25
  [tool.poetry.group.dev.dependencies]
27
- black = "^22.10.0"
28
- flake8 = "^5.0.4"
29
- mypy = "^0.982"
30
- pytest = "^7.2.0"
31
- isort = "^5.10.1"
26
+ pytest = "^8.0.0"
27
+ mypy = "^1.8.0"
32
28
  types-pyyaml = "^6.0.12.11"
29
+ ruff = "^0.2.1"
33
30
 
34
31
  [build-system]
35
32
  requires = ["poetry-core>=1.0.0"]
@@ -48,7 +45,6 @@ show_error_codes = true
48
45
  disallow_untyped_defs = true
49
46
  disallow_incomplete_defs = true
50
47
 
51
-
52
48
  [[tool.mypy.overrides]]
53
49
  module = ["getkey.*"]
54
50
  ignore_missing_imports = true
@@ -62,8 +58,30 @@ major_version_zero = true
62
58
  change_type_map = { "feat" = "Features", "fix" = "Bug Fixes" }
63
59
  tag_format = "v$version"
64
60
 
65
- [tool.isort]
66
- profile = "black"
67
- multi_line_output = 3
68
- force_grid_wrap = 2
69
- float_to_top = true
61
+ [tool.ruff]
62
+ line-length = 88
63
+ target-version = 'py311'
64
+ required-version = "0.2.1"
65
+ src = ["qontract_development_cli"]
66
+ extend-exclude = [".local", ".cache"]
67
+ fix = true
68
+
69
+ [tool.ruff.lint]
70
+ preview = true
71
+ # defaults are ["E4", "E7", "E9", "F"]
72
+ extend-select = [
73
+ # flake8 default rules
74
+ "E1", # preview rule
75
+ "E2", # preview rule
76
+ "W",
77
+ # isort
78
+ "I",
79
+ # pylint
80
+ "PL",
81
+ ]
82
+
83
+ [tool.ruff.format]
84
+ preview = true
85
+
86
+ [tool.ruff.lint.isort]
87
+ known-first-party = ["qontract_development_cli"]
@@ -77,4 +77,4 @@ def init() -> None:
77
77
  def edit() -> None:
78
78
  """Edit config in your editor."""
79
79
  console.print(f"Opening [b]{user_config_file}[/] in your editor ...")
80
- subprocess.run([config.editor, user_config_file])
80
+ subprocess.run([config.editor, user_config_file], check=True)
@@ -18,7 +18,7 @@ def edit(env_name: str = typer.Argument(..., help="Env to edit or create.")) ->
18
18
  """Create/edit an environment file in your editor."""
19
19
  env = Env(name=env_name)
20
20
  console.print(f"Opening [b]{env.name}[/] in your editor ...")
21
- subprocess.run([config.editor, env.file])
21
+ subprocess.run([config.editor, env.file], check=True)
22
22
 
23
23
 
24
24
  @app.command()
@@ -34,7 +34,7 @@ def ls() -> None:
34
34
  def rm(
35
35
  env_name: str = typer.Argument(
36
36
  ..., help="Environment to remove.", autocompletion=complete_env
37
- )
37
+ ),
38
38
  ) -> None:
39
39
  """Remove environment."""
40
40
  env = Env(name=env_name)
@@ -46,7 +46,7 @@ def rm(
46
46
  def show(
47
47
  env_name: str = typer.Argument(
48
48
  ..., help="Environment to display.", autocompletion=complete_env
49
- )
49
+ ),
50
50
  ) -> None:
51
51
  """Display environment."""
52
52
  env = Env(name=env_name)
@@ -42,7 +42,7 @@ log = logging.getLogger(__name__)
42
42
 
43
43
 
44
44
  @app.command()
45
- def create(
45
+ def create( # noqa: PLR0913, PLR0917
46
46
  profile_name: str = typer.Argument(..., help="Profile to create."),
47
47
  integration_name: Optional[str] = typer.Option(None),
48
48
  integration_extra_args: Optional[str] = typer.Option(None),
@@ -129,12 +129,12 @@ def create(
129
129
  def edit(
130
130
  profile_name: str = typer.Argument(
131
131
  ..., help="Profile to edit.", autocompletion=complete_profile
132
- )
132
+ ),
133
133
  ) -> None:
134
134
  """Edit a profile in your editor."""
135
135
  profile = Profile(name=profile_name)
136
136
  console.print(f"Opening [b]{profile.name}[/] in your editor ...")
137
- subprocess.run([config.editor, profile.file])
137
+ subprocess.run([config.editor, profile.file], check=True)
138
138
 
139
139
 
140
140
  @app.command()
@@ -165,7 +165,7 @@ def rm(
165
165
  def show(
166
166
  profile_name: str = typer.Argument(
167
167
  ..., help="Profile to display.", autocompletion=complete_profile
168
- )
168
+ ),
169
169
  ) -> None:
170
170
  """Display profile."""
171
171
  profile = Profile(name=profile_name)
@@ -173,7 +173,7 @@ def show(
173
173
 
174
174
 
175
175
  @app.command(no_args_is_help=True)
176
- def run(
176
+ def run( # noqa: PLR0912, PLR0917, PLR0913, PLR0915
177
177
  env_name: str = typer.Argument(
178
178
  ..., help="Environment to use.", autocompletion=complete_env
179
179
  ),
@@ -238,16 +238,18 @@ def run(
238
238
  )
239
239
  console.print(settings)
240
240
 
241
- tmp_dir = Path(tempfile.mkdtemp(prefix="qd-"))
242
- compose_file = tmp_dir / "compose.yml"
243
- compose_file.write_text(
244
- template(
245
- "compose.yml.j2",
246
- config=config,
247
- env=env,
248
- profile=profile,
241
+ compose_dir = Path(tempfile.mkdtemp(prefix="qd-"))
242
+ # render compose files
243
+ for f in ["compose.override.yml", "compose.yml"]:
244
+ compose_file = compose_dir / f
245
+ compose_file.write_text(
246
+ template(
247
+ f"{f}.j2",
248
+ config=config,
249
+ env=env,
250
+ profile=profile,
251
+ )
249
252
  )
250
- )
251
253
 
252
254
  if env.settings.run_qontract_server and not skip_initial_make_bundle:
253
255
  make_bundle(
@@ -54,6 +54,16 @@ class ProfileSettings(BaseModel):
54
54
  additional_environment: dict[str, Any] = {}
55
55
  internal_redhat_ca: bool = False
56
56
  extra_hosts: list[str] = []
57
+ localstack: bool = False
58
+ localstack_compose_file: Path | None
59
+
60
+ @validator("localstack_compose_file", always=True)
61
+ def default_localstack_compose_file(cls, v: Path | None, values: dict) -> Path:
62
+ return (
63
+ v
64
+ if v
65
+ else values["qontract_reconcile_path"] / "dev/localstack/docker-compose.yml"
66
+ )
57
67
 
58
68
 
59
69
  class Base(BaseModel):
@@ -144,7 +154,10 @@ class Profile(Base):
144
154
 
145
155
  @property
146
156
  def default_settings_as_dict(self) -> dict[str, Any]:
147
- defaults = {"integration_name": "changeme", "integration_extra_args": ""}
157
+ defaults = {
158
+ "integration_name": "changeme",
159
+ "integration_extra_args": "",
160
+ }
148
161
  try:
149
162
  defaults.update(
150
163
  yaml.safe_load(
@@ -38,7 +38,7 @@ def compose_up(
38
38
  compose_cmd.append("--remove-orphans")
39
39
  if build:
40
40
  compose_cmd.append("--build")
41
- subprocess.run(compose_cmd)
41
+ subprocess.run(compose_cmd, check=True)
42
42
 
43
43
 
44
44
  def compose_restart(compose_file: Path, container: str) -> None:
@@ -49,19 +49,19 @@ def compose_restart(compose_file: Path, container: str) -> None:
49
49
  "restart",
50
50
  container,
51
51
  ]
52
- subprocess.run(compose_cmd)
52
+ subprocess.run(compose_cmd, check=True)
53
53
 
54
54
 
55
55
  def container_restart(container: str) -> None:
56
56
  log.info(f"Restarting {container} container")
57
57
  compose_cmd = ["docker", "restart", container]
58
- subprocess.run(compose_cmd)
58
+ subprocess.run(compose_cmd, check=True)
59
59
 
60
60
 
61
61
  def compose_down(compose_file: Path) -> None:
62
62
  log.info("Stopping all containers")
63
63
  compose_cmd = _docker_compose_bin + ["-f", str(compose_file), "down"]
64
- subprocess.run(compose_cmd)
64
+ subprocess.run(compose_cmd, check=True)
65
65
 
66
66
 
67
67
  def compose_log_tail(compose_file: Path) -> Process:
@@ -85,16 +85,20 @@ def compose_stop_project(project_name: str) -> None:
85
85
  log.info("Stopping running projects")
86
86
  for p in compose_list_projects():
87
87
  if p["Name"] == project_name:
88
- subprocess.run(_docker_compose_bin + ["-f", p["ConfigFiles"], "down"])
88
+ subprocess.run(
89
+ _docker_compose_bin + ["-f", p["ConfigFiles"], "down"], check=True
90
+ )
89
91
 
90
92
 
91
93
  def make_bundle(app_interface_path: Path, qontract_server_path: Path) -> None:
92
94
  log.info("Make bundle")
93
95
  shell_env = copy.deepcopy(os.environ)
94
- shell_env.update(
95
- {"APP_INTERFACE_PATH": str(app_interface_path.expanduser().absolute())}
96
+ shell_env.update({
97
+ "APP_INTERFACE_PATH": str(app_interface_path.expanduser().absolute())
98
+ })
99
+ subprocess.run(
100
+ ["make", "-C", str(qontract_server_path), "bundle"], env=shell_env, check=True
96
101
  )
97
- subprocess.run(["make", "-C", str(qontract_server_path), "bundle"], env=shell_env)
98
102
 
99
103
 
100
104
  def make_bundle_and_restart_server(
@@ -114,14 +118,12 @@ def fetch_pull_requests(profile: Profile, worktrees_dir: Path) -> None:
114
118
  / profile.settings.app_interface_path.name
115
119
  / str(profile.settings.app_interface_pr)
116
120
  )
117
- repos.append(
118
- {
119
- "workdir": str(wd),
120
- "dir": str(profile.settings.app_interface_path),
121
- "pr": str(profile.settings.app_interface_pr),
122
- "upstream": profile.settings.app_interface_upstream,
123
- }
124
- )
121
+ repos.append({
122
+ "workdir": str(wd),
123
+ "dir": str(profile.settings.app_interface_path),
124
+ "pr": str(profile.settings.app_interface_pr),
125
+ "upstream": profile.settings.app_interface_upstream,
126
+ })
125
127
  profile.settings.app_interface_path = wd
126
128
  if profile.settings.qontract_schemas_pr:
127
129
  wd = (
@@ -129,14 +131,12 @@ def fetch_pull_requests(profile: Profile, worktrees_dir: Path) -> None:
129
131
  / profile.settings.qontract_schemas_path.name
130
132
  / str(profile.settings.qontract_schemas_pr)
131
133
  )
132
- repos.append(
133
- {
134
- "workdir": str(wd),
135
- "dir": str(profile.settings.qontract_schemas_path),
136
- "pr": str(profile.settings.qontract_schemas_pr),
137
- "upstream": profile.settings.qontract_schemas_upstream,
138
- }
139
- )
134
+ repos.append({
135
+ "workdir": str(wd),
136
+ "dir": str(profile.settings.qontract_schemas_path),
137
+ "pr": str(profile.settings.qontract_schemas_pr),
138
+ "upstream": profile.settings.qontract_schemas_upstream,
139
+ })
140
140
  profile.settings.qontract_schemas_path = wd
141
141
  if profile.settings.qontract_reconcile_pr:
142
142
  wd = (
@@ -144,14 +144,12 @@ def fetch_pull_requests(profile: Profile, worktrees_dir: Path) -> None:
144
144
  / profile.settings.qontract_reconcile_path.name
145
145
  / str(profile.settings.qontract_reconcile_pr)
146
146
  )
147
- repos.append(
148
- {
149
- "workdir": str(wd),
150
- "dir": str(profile.settings.qontract_reconcile_path),
151
- "pr": str(profile.settings.qontract_reconcile_pr),
152
- "upstream": profile.settings.qontract_reconcile_upstream,
153
- }
154
- )
147
+ repos.append({
148
+ "workdir": str(wd),
149
+ "dir": str(profile.settings.qontract_reconcile_path),
150
+ "pr": str(profile.settings.qontract_reconcile_pr),
151
+ "upstream": profile.settings.qontract_reconcile_upstream,
152
+ })
155
153
  profile.settings.qontract_reconcile_path = wd
156
154
 
157
155
  if not repos:
@@ -0,0 +1,7 @@
1
+ ---
2
+ {% if profile.settings.localstack %}
3
+ services:
4
+ localstack:
5
+ networks:
6
+ - qontract-development
7
+ {% endif %}
@@ -47,6 +47,12 @@ services:
47
47
  {% endif %}
48
48
  - gitlab_pr_submitter_queue_url={{ env.settings.gitlab_pr_submitter_queue_url }}
49
49
  - LOG_LEVEL={{ profile.settings.log_level.upper() }}
50
+ {% if profile.settings.localstack %}
51
+ - AWS_ENDPOINT_URL=http://localstack:4566
52
+ - AWS_ACCESS_KEY_ID=test
53
+ - AWS_SECRET_ACCESS_KEY=test
54
+ - AWS_REGION=us-east-1
55
+ {% endif %}
50
56
  {% for key, value in profile.settings.additional_environment.items() %}
51
57
  - {{ key }}={{ value }}
52
58
  {% endfor %}
@@ -93,6 +99,8 @@ services:
93
99
  image: {{ profile.settings.qontract_server_image }}
94
100
  {% endif %}
95
101
  container_name: qontract-server
102
+ stop_grace_period: 1s
103
+ stop_signal: SIGKILL
96
104
  volumes:
97
105
  - {{ profile.settings.qontract_server_path.expanduser().absolute() }}/bundle:/bundle:ro
98
106
  environment:
@@ -129,3 +137,8 @@ volumes:
129
137
  networks:
130
138
  qontract-development:
131
139
  name: qontract-development
140
+
141
+ {% if profile.settings.localstack %}
142
+ include:
143
+ - {{ profile.settings.localstack_compose_file }}
144
+ {% endif %}
@@ -0,0 +1,41 @@
1
+ # -*- coding: utf-8 -*-
2
+ from setuptools import setup
3
+
4
+ packages = \
5
+ ['qontract_development_cli', 'qontract_development_cli.commands']
6
+
7
+ package_data = \
8
+ {'': ['*'], 'qontract_development_cli': ['templates/*']}
9
+
10
+ install_requires = \
11
+ ['Jinja2>=3.1.2,<4.0.0',
12
+ 'PyYAML>=6.0.1,<7.0.0',
13
+ 'appdirs>=1.4.4,<2.0.0',
14
+ 'getkey>=0.6.5,<0.7.0',
15
+ 'pydantic>=1.10.2,<2.0.0',
16
+ 'rich>=13.7.0,<14.0.0',
17
+ 'typer>=0.9.0,<0.10.0',
18
+ 'watchfiles>=0.21.0,<0.22.0']
19
+
20
+ entry_points = \
21
+ {'console_scripts': ['qd = qontract_development_cli.__main__:app']}
22
+
23
+ setup_kwargs = {
24
+ 'name': 'qontract-development-cli',
25
+ 'version': '0.14.0',
26
+ 'description': 'Helper tool for qontract-reconcile development',
27
+ 'long_description': "# Qontract Development CLI\n\n[![PyPI](https://img.shields.io/pypi/v/qontract-development-cli)][pypi-link]\n[![PyPI platforms][pypi-platforms]][pypi-link]\n![PyPI - License](https://img.shields.io/pypi/l/qontract-development-cli)\n\nQontract Development CLI supports your daily [qontract-reconcile][qontract-reconcile] development work.\n\n[toc]\n\n## Installation\n\nYou can install this library from [PyPI][pypi-link] with `pip`:\n\n```shell\npython3 -m pip install qontract-development-cli\n```\n\nOr install it with `pipx`:\n\n```shell\npipx install qontract-development-cli\n```\n\nYou can also use `pipx` to run the library without installing it:\n\n```shell\npipx run qontract-development-cli\n```\n\n## Quickstart\n\n* Create initial configuration\n\n ```shell\n qd config init\n ```\n\n ![qd init](/demo/qd_config_init.gif)\n\n* Create a profile `sql-query` to run the `sql-query` integration\n\n ```shell\n qd profile create sql-query\n ```\n\n ![qd profile create](/demo/qd_profile_create.gif)\n\n* Run `sql-query` profile\n\n ```shell\n qd profile run dev sql-query\n ```\n\n ![qd sql_query](/images/profile_run_sql_query.svg)\n\n## Features\n\nQontract Development CLI currently provides the following features (get help with `-h` or `--help`):\n\n* Run `qontract-reconcile` and `qontract-server` as docker containers on your local machine\n* Support for different App-Interface environments (dev, prod, ...) via the `env` command\n* Configure your [qontract-reconcile integration][qontract-reconcile] with the `profile` command\n* Support pull request reviews (see `profile create`)\n* Bootstrap your initial configurations with the `config` command\n* Shell auto-completion (see `qd --help`)\n* Automatically restart `qontract-reconcile` container when files change\n* Automatically rebuild the App-Interface bundle and restart the `qontract-server` container when files change\n\n## Examples\n\nTake a look at the [examples](examples) directory for different profile examples.\n\n## Usage\n\nThe following sections describe all available commands and their options.\n\n### Config\n\nManage global qontract-development-cli configuration.\n\n`qd config [sub-cmd] --help`\n\n* **edit**: open the configuration file in your favorite editor\n* **init**: create a default configuration\n\n#### Global Settings\n\n| **Key** | **Description** | **Default** |\n| --------------------------- | ------------------------------------- | ------------------------------------ |\n| debug | Enable/disable debug mode | false |\n| defaults_profile | Name of defaults profile | defaults |\n| docker_compose_project_name | Docker compose project name | qontract-development |\n| editor | Your favorite editor | $EDITOR or vim |\n| environments_dir | Directory to store environment files | User config directory / environments |\n| profiles_dir | Directory to store profile files | User config directory / profiles |\n| worktrees_dir | Directory to store git repo worktrees | User cache directory / worktrees |\n\n### Environments\n\nAn environment specifies app-interface instance settings, e.g., **dev** vs. **prod** config and path to the actual app-interface instance.\n\n`qd env [sub-cmd] --help`\n\n* **edit**: Create/edit an environment file in your editor.\n* **ls**: List all available environments.\n* **rm**: Remove environment.\n* **show**: Display environment.\n\n#### Environment Settings\n\n| **Key** | **Description** | **Default** |\n| ---------------------------------- | ------------------------------------ | ---------------------------------------------- |\n| **app_interface_path** | Path to local app-interface instance | ~/workspace/app-interface |\n| app_interface_state_bucket | S3 bucket | empty |\n| app_interface_state_bucket_account | AWS S3 account | empty |\n| **config** | app-interface config | ~/workspace/qontract-reconcile/config.dev.toml |\n| gitlab_pr_submitter_queue_url | Gitlab pr submitter queue url | |\n| run_qontract_reconcile | Run qontract-reconcile container | true |\n| run_qontract_server | Run qontract-server container | true |\n| run_vault | Run vault container | false |\n\n> :point_right: **Bold keys** are mandatory or should be customized.\n\n### Profiles\n\nA profile specifies all settings to run a qontract-reconcile integration (e.g., *sql-query*).\n\n`qd profile [sub-cmd] --help`\n\n* **create**: Create a new profile to run an integration.\n\n Supports the creation of a new profile from an open PR/MR. See `$ qd profile create --help` for all available options.\n\n* **edit**: Edit a profile in your editor.\n* **ls**: List all available profiles.\n* **rm**: Remove profile.\n* **run**: Run a profile.\n* **show**: Display profile.\n\n#### --no-dry-run\n\nBy default, `qd` runs integrations in `dry-run` mode if not explicitly specified differently in the profile config.\nThere is also a `--no-dry-run` flag which lets you disable `dry-run` mode from the command line.\n\n```shell\nqd profile run dev my-integration --no-dry-run\n```\n\nThe command line flag takes precedence over any configuration you might have in the profile settings.\n\n#### Profile Settings\n\n| **Key** | **Description** | **Default** |\n| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |\n| additional_environment | Dictionary of additional environment variables to pass to the qontract-reconcile container | `{}` |\n| container_uid | Change ownership of /recconcile files in container to this user id | current UID |\n| command | Command to run in the qontract-reconcile container. | `dockerfiles/hack/run-integration.py` |\n| command_extra_args | Additional arguments to pass to the command. | |\n| debugger | Python debugger | `debugpy` |\n| dry_run | Run --dry-run mode | `true` |\n| extra_hosts | List of 'HOSTNAME:IP' mapping entries for qontract-reconcile `/etc/hosts`. See [extra_hosts](https://docs.docker.com/compose/compose-file/#extra_hosts) docker compose file. | `[]` |\n| **integration_name** | Intergration name | |\n| **integration_extra_args** | Intergration extra arguments | |\n| **internal_redhat_ca** | Inject Red Hat internal CAs and `REQUESTS_CA_BUNDLE` environment variable | `false` |\n| log_level | Log level | `info` |\n| app_interface_path | App-interface instance path. (Overrides *env.app_interface_path*) | |\n| app_interface_pr | App-interface PR/MR number | |\n| app_interface_upstream | Upstream remote name | `upstream` |\n| qontract_reconcile_build_image | Build qontract-reconcile image | `true` |\n| qontract_reconcile_image | Qontract-reconcile image | `quay.io/app-sre/qontract-reconcile:latest` |\n| qontract_reconcile_path | Qontract-reconcile path | `~/workspace/qontract-reconcile` |\n| qontract_reconcile_pr | Qontract-reconcile PR/MR number | |\n| qontract_reconcile_upstream | Upstream remote name | `upstream` |\n| qontract_server_build_image | Build qontract-server image | `true` |\n| qontract_server_image | Qontract-server image | `quay.io/app-sre/qontract-server:lates`t |\n| qontract_server_path | Qontract-server path | `~/workspace/qontract-server` |\n| qontract_schemas_path | Qontract-schemas path | `~/workspace/qontract-schemas` |\n| qontract_schemas_pr | Qontract-schemas PR/MR number | |\n| qontract_schemas_upstream | Upstream remote name | `upstream` |\n| run_once | If 'true', execute the integration once and exit | `true` |\n| sleep_duration_secs | If not *run_once*, sleep duration until integration runs again | `10` |\n| localstack | Run localstack container and set AWS related environment variables | `false` |\n| localstack_compose_file | Path to your Localstack docker-compose file | `qontract_server_path` / `dev/localstack/docker-compose.yml` |\n\n> :point_right: **Bold keys** are mandatory or should be customized.\n\n### PR/MR support\n\nIt's a pretty handy feature to create a profile from a pull request (merge request). E.g.:\n\n```shell\nqd 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\n```\n\nWhich results in this profile:\n\n```shell\n$ qd profile show glitchtip-pr-check\n---\napp_interface_path: PATH_TO_YOUR_LOCAL/app-interface-dev-data\napp_interface_pr: NUMBER\nintegration_name: glitchtip\nqontract_reconcile_pr: NUMBER\nqontract_schemas_pr: NUMBER\n```\n\nRunning this profile will:\n\n* Create new git worktrees (see `config.worktrees_dir`) for app-interface-dev-data, qontract-schema, and qontract-reconcile PRs\n* Start the containers with the adapted path to these worktrees\n* Restarting the profile will fetch PR updates\n\n> :point_right: A git worktree cleanup isn't implemented yet\n\n## Development\n\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)\n\n### Release\n\n* Bump the version in `pyproject.toml`\n* Update the `CHANGELOG.md`\n* Commit the changes\n\n[pypi-link]: https://pypi.org/project/qontract-development-cli/\n[pypi-platforms]: https://img.shields.io/pypi/pyversions/qontract-development-cli\n[qontract-reconcile]: https://github.com/app-sre/qontract-reconcile\n",
28
+ 'author': 'Christian Assing',
29
+ 'author_email': 'cassing@redhat.com',
30
+ 'maintainer': 'None',
31
+ 'maintainer_email': 'None',
32
+ 'url': 'http://github.com/chassing/qontract-development-cli',
33
+ 'packages': packages,
34
+ 'package_data': package_data,
35
+ 'install_requires': install_requires,
36
+ 'entry_points': entry_points,
37
+ 'python_requires': '>=3.11,<4.0',
38
+ }
39
+
40
+
41
+ setup(**setup_kwargs)
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 Christian Assing
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,42 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- from setuptools import setup
3
-
4
- packages = \
5
- ['qontract_development_cli', 'qontract_development_cli.commands']
6
-
7
- package_data = \
8
- {'': ['*'], 'qontract_development_cli': ['templates/*']}
9
-
10
- install_requires = \
11
- ['Jinja2>=3.1.2,<4.0.0',
12
- 'PyYAML>=6.0,<7.0',
13
- 'appdirs>=1.4.4,<2.0.0',
14
- 'getkey>=0.6.5,<0.7.0',
15
- 'pydantic>=1.10.2,<2.0.0',
16
- 'rich>=12.5.1,<13.0.0',
17
- 'textual>=0.2.1,<0.3.0',
18
- 'typer>=0.6.1,<0.7.0',
19
- 'watchfiles>=0.18.0,<0.19.0']
20
-
21
- entry_points = \
22
- {'console_scripts': ['qd = qontract_development_cli.__main__:app']}
23
-
24
- setup_kwargs = {
25
- 'name': 'qontract-development-cli',
26
- 'version': '0.13.2',
27
- 'description': 'Helper tool for qontract-reconcile development',
28
- 'long_description': '# Qontract Development CLI\n\n[![PyPI](https://img.shields.io/pypi/v/qontract-development-cli)][pypi-link]\n[![PyPI platforms][pypi-platforms]][pypi-link]\n![PyPI - License](https://img.shields.io/pypi/l/qontract-development-cli)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nQontract Development CLI supports your daily [qontract-reconcile][qontract-reconcile] development work.\n\n## Installation\n\nYou can install this library from [PyPI][pypi-link] with `pip`:\n\n```shell\n$ python3 -m pip install qontract-development-cli\n```\n\nOr install it with `pipx`:\n```shell\n$ pipx install qontract-development-cli\n```\n\nYou can also use `pipx` to run the library without installing it:\n\n```shell\n$ pipx run qontract-development-cli\n```\n\n## Quickstart\n\n* Create initial configuration\n ```shell\n $ qd config init\n ```\n <img src="demo/qd_config_init.gif" />\n\n* Create a profile `sql-query` to run the `sql-query` integration\n ```shell\n $ qd profile create sql-query\n ```\n <img src="demo/qd_profile_create.gif" />\n\n* Run `sql-query` profile\n ```shell\n $ profile run dev sql-query\n ```\n <img src="images/profile_run_sql_query.svg" />\n\n## Features\n\nQontract Development CLI currently provides the following features (get help with `-h` or `--help`):\n\n- Run `qontract-reconcile` and `qontract-server` as docker containers on your local machine\n- Support for different App-Interface environments (dev, prod, ...) via the `env` command\n- Configure your [qontract-reconcile integration][qontract-reconcile] with the `profile` command\n- Support pull request reviews (see `profile create`)\n- Bootstrap your initial configurations with the `config` command\n- Shell auto-completion (see `qd --help`)\n- Automatically restart `qontract-reconcile` container when files change\n- Automatically rebuild the App-Interface bundle and restart the `qontract-server` container when files change\n\n## Examples\n\nTake a look at the [examples](examples) directory for different profile examples.\n\n## Usage\n\nThe following sections describe all available commands and their options.\n\n### Config\n\nManage global qontract-development-cli configuration.\n\n`$ qd config [sub-cmd] --help`\n\n* **edit**: open the configuration file in your favorite editor\n* **init**: create a default configuration\n\n#### Settings\n| **Key** | **Description** | **Default** |\n| --------------------------- | ------------------------------------- | ------------------------------------ |\n| debug | Enable/disable debug mode | false |\n| defaults_profile | Name of defaults profile | defaults |\n| docker_compose_project_name | Docker compose project name | qontract-development |\n| editor | Your favorite editor | $EDITOR or vim |\n| environments_dir | Directory to store environment files | User config directory / environments |\n| profiles_dir | Directory to store profile files | User config directory / profiles |\n| worktrees_dir | Directory to store git repo worktrees | User cache directory / worktrees |\n\n## Environments\n\nAn environment specifies app-interface instance settings, e.g., **dev** vs. **prod** config and path to the actual app-interface instance.\n\n`$ qd env [sub-cmd] --help`\n\n* **edit**: Create/edit an environment file in your editor.\n* **ls**: List all available environments.\n* **rm**: Remove environment.\n* **show**: Display environment.\n\n\n#### Settings\n\n| **Key** | **Description** | **Default** |\n| ---------------------------------- | ------------------------------------ | ---------------------------------------------- |\n| **app_interface_path** | Path to local app-interface instance | ~/workspace/app-interface |\n| app_interface_state_bucket | S3 bucket | empty |\n| app_interface_state_bucket_account | AWS S3 account | empty |\n| **config** | app-interface config | ~/workspace/qontract-reconcile/config.dev.toml |\n| gitlab_pr_submitter_queue_url | Gitlab pr submitter queue url | |\n| run_qontract_reconcile | Run qontract-reconcile container | true |\n| run_qontract_server | Run qontract-server container | true |\n| run_vault | Run vault container | false |\n\n> :point_right: **Bold keys** are mandatory or should be customized.\n\n## Profiles\n\nA profile specifies all settings to run a qontract-reconcile integration (e.g., *sql-query*).\n\n`$ qd profile [sub-cmd] --help`\n\n* **create**: Create a new profile to run an integration.\n\n Supports the creation of a new profile from an open PR/MR. See `$ qd profile create --help` for all available options.\n\n* **edit**: Edit a profile in your editor.\n* **ls**: List all available profiles.\n* **rm**: Remove profile.\n* **run**: Run a profile.\n* **show**: Display profile.\n\n### --no-dry-run\n\nBy default `qd` runs integrations in `dry-run` mode if not explicitly specified differently in the profile config.\nThere is also a `--no-dry-run` flag which lets you disable `dry-run` mode from command line.\n\n```\n$ qd profile run dev my-integration --no-dry-run\n```\n\nThe command line flag takes precedence over any configuration you might have in the profile settings.\n\n#### Settings\n\n| **Key** | **Description** | **Default** |\n| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |\n| additional_environment | Dictionary of additional environment variables to pass to the qontract-reconcile container | `{}` |\n| container_uid | Change ownership of /recconcile files in container to this user id | current UID |\n| command | Command to run in the qontract-reconcile container. | `dockerfiles/hack/run-integration.py` |\n| command_extra_args | Additional arguments to pass to the command. | |\n| debugger | Python debugger | `debugpy` |\n| dry_run | Run --dry-run mode | `true` |\n| extra_hosts | List of \'HOSTNAME:IP\' mapping entries for qontract-reconcile `/etc/hosts`. See [extra_hosts](https://docs.docker.com/compose/compose-file/#extra_hosts) docker compose file. | `[]` |\n| **integration_name** | Intergration name | |\n| **integration_extra_args** | Intergration extra arguments | |\n| **internal_redhat_ca** | Inject Red Hat internal CAs and `REQUESTS_CA_BUNDLE` environment variable | `false` |\n| log_level | Log level | `info` |\n| app_interface_path | App-interface instance path. (Overrides *env.app_interface_path*) | |\n| app_interface_pr | App-interface PR/MR number | |\n| app_interface_upstream | Upstream remote name | `upstream` |\n| qontract_reconcile_build_image | Build qontract-reconcile image | `true` |\n| qontract_reconcile_image | Qontract-reconcile image | `quay.io/app-sre/qontract-reconcile:latest` |\n| qontract_reconcile_path | Qontract-reconcile path | `~/workspace/qontract-reconcile` |\n| qontract_reconcile_pr | Qontract-reconcile PR/MR number | |\n| qontract_reconcile_upstream | Upstream remote name | `upstream` |\n| qontract_server_build_image | Build qontract-server image | `true` |\n| qontract_server_image | Qontract-server image | `quay.io/app-sre/qontract-server:lates`t |\n| qontract_server_path | Qontract-server path | `~/workspace/qontract-server` |\n| qontract_schemas_path | Qontract-schemas path | `~/workspace/qontract-schemas` |\n| qontract_schemas_pr | Qontract-schemas PR/MR number | |\n| qontract_schemas_upstream | Upstream remote name | `upstream` |\n| run_once | If \'true\', execute the integration once and exit | `true` |\n| sleep_duration_secs | If not *run_once*, sleep duration until integration runs again | `10` |\n\n> :point_right: **Bold keys** are mandatory or should be customized.\n\n### PR/MR support\n\nIt\'s a pretty handy feature to create a profile from a pull request (merge request). E.g.:\n\n```shell\n$ 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\n```\n\nWhich results in this profile:\n\n```shell\n$ qd profile show glitchtip-pr-check\n---\napp_interface_path: PATH_TO_YOUR_LOCAL/app-interface-dev-data\napp_interface_pr: NUMBER\nintegration_name: glitchtip\nqontract_reconcile_pr: NUMBER\nqontract_schemas_pr: NUMBER\n```\n\nRunning this profile will:\n* Create new git worktrees (see `config.worktrees_dir`) for app-interface-dev-data, qontract-schema, and qontract-reconcile PRs\n* Start the containers with the adapted path to these worktrees\n* Restarting the profile will fetch PR updates\n\n> :point_right: A git worktree cleanup isn\'t implemented yet\n\n## Development\n\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)\n\n### Release\n\n* Bump the version in `pyproject.toml`\n* Update the `CHANGELOG.md`\n* Commit the changes\n\n\n[pypi-link]: https://pypi.org/project/qontract-development-cli/\n[pypi-platforms]: https://img.shields.io/pypi/pyversions/qontract-development-cli\n[pypi-version]: https://badge.fury.io/py/qontract-development-cli.svg\n[qontract-reconcile]: https://github.com/app-sre/qontract-reconcile\n',
29
- 'author': 'Christian Assing',
30
- 'author_email': 'cassing@redhat.com',
31
- 'maintainer': 'None',
32
- 'maintainer_email': 'None',
33
- 'url': 'http://github.com/chassing/qontract-development-cli',
34
- 'packages': packages,
35
- 'package_data': package_data,
36
- 'install_requires': install_requires,
37
- 'entry_points': entry_points,
38
- 'python_requires': '>=3.9,<4.0',
39
- }
40
-
41
-
42
- setup(**setup_kwargs)