qontract-development-cli 0.16.0__tar.gz → 0.17.1__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 (28) hide show
  1. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/PKG-INFO +23 -3
  2. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/README.md +20 -0
  3. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/pyproject.toml +4 -4
  4. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/commands/profile.py +1 -0
  5. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/models.py +11 -1
  6. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/shell.py +14 -5
  7. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/templates/api.yml.j2 +0 -1
  8. qontract_development_cli-0.17.1/qontract_development_cli/templates/subscriber.yml.j2 +31 -0
  9. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/templates/worker.yml.j2 +1 -2
  10. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/__init__.py +0 -0
  11. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/__main__.py +0 -0
  12. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/cli.py +0 -0
  13. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/commands/__init__.py +0 -0
  14. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/commands/config.py +0 -0
  15. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/commands/env.py +0 -0
  16. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/completions.py +0 -0
  17. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/config.py +0 -0
  18. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/templates/cache.yml.j2 +0 -0
  19. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/templates/compose.override.yml.j2 +0 -0
  20. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/templates/compose.yml.j2 +0 -0
  21. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/templates/internal-redhat-ca.yml.j2 +0 -0
  22. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/templates/prep-worktree.sh.j2 +0 -0
  23. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/templates/reconcile.yml.j2 +0 -0
  24. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/templates/server.yml.j2 +0 -0
  25. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/templates/vault.yml.j2 +0 -0
  26. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/templates.py +0 -0
  27. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/utils.py +0 -0
  28. {qontract_development_cli-0.16.0 → qontract_development_cli-0.17.1}/qontract_development_cli/watchdog.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qontract-development-cli
3
- Version: 0.16.0
3
+ Version: 0.17.1
4
4
  Summary: Helper tool for qontract-reconcile development
5
5
  Project-URL: homepage, http://github.com/chassing/qontract-development-cli
6
6
  Project-URL: repository, http://github.com/chassing/qontract-development-cli
@@ -14,8 +14,8 @@ Requires-Dist: jinja2~=3.1
14
14
  Requires-Dist: pydantic-settings~=2.6
15
15
  Requires-Dist: pydantic~=2.9
16
16
  Requires-Dist: pyyaml~=6.0.2
17
- Requires-Dist: rich~=14.0
18
- Requires-Dist: typer~=0.21.0
17
+ Requires-Dist: rich~=15.0
18
+ Requires-Dist: typer~=0.25.1
19
19
  Requires-Dist: watchfiles~=1.1.0
20
20
  Description-Content-Type: text/markdown
21
21
 
@@ -153,6 +153,7 @@ An environment specifies app-interface instance settings, e.g., **dev** vs. **pr
153
153
  | container_platform | Default Docker container platform for all images | linux/amd64 |
154
154
  | gitlab_pr_submitter_queue_url | Gitlab pr submitter queue url | |
155
155
  | run_qontract_api | Run qontract-api container | false |
156
+ | run_qontract_api_subscriber | Run qontract-api-subscriber container | false |
156
157
  | run_qontract_api_worker | Run qontract-api-worker container | false |
157
158
  | run_cache | Run cache (Redis) container | false |
158
159
  | run_qontract_reconcile | Run qontract-reconcile container | true |
@@ -216,6 +217,11 @@ The command line flag takes precedence over any configuration you might have in
216
217
  | qontract_api_container_platform | Qontract-api container platform | Default from [environment](#environment-settings) |
217
218
  | qontract_api_compose_file | Qontract-api docker-compose file template | `api.yml.j2` |
218
219
  | qontract_api_debugger_port | Debugger port for qontract-api | `5679` |
220
+ | qontract_api_subscriber_build_image | Build qontract-api-subscriber image | `true` |
221
+ | qontract_api_subscriber_image | Qontract-api-subscriber image | `quay.io/redhat-services-prod/.../qontract-api-master:latest` |
222
+ | qontract_api_subscriber_container_platform | Qontract-api-subscriber container platform | Default from [environment](#environment-settings) |
223
+ | qontract_api_subscriber_compose_file | Qontract-api-subscriber docker-compose file template | `subscriber.yml.j2` |
224
+ | qontract_api_subscriber_debugger_port | Debugger port for qontract-api-subscriber | `5681` |
219
225
  | qontract_api_worker_build_image | Build qontract-api-worker image | `true` |
220
226
  | qontract_api_worker_image | Qontract-api-worker image | `quay.io/redhat-services-prod/.../qontract-api-worker-master:latest` |
221
227
  | qontract_api_worker_container_platform | Qontract-api-worker container platform | Default from [environment](#environment-settings) |
@@ -283,6 +289,19 @@ Note that the Qontract Reconcile container will not start running until it is co
283
289
  "enable": true
284
290
  }
285
291
  },
292
+ {
293
+ "name": "Python Debugger: Subscriber",
294
+ "type": "debugpy",
295
+ "request": "attach",
296
+ "connect": { "host": "localhost", "port": 5681 },
297
+ "pathMappings": [
298
+ { "localRoot": "${workspaceFolder}", "remoteRoot": "/opt/app-root/src" }
299
+ ],
300
+ "justMyCode": true,
301
+ "autoReload": {
302
+ "enable": true
303
+ }
304
+ },
286
305
  {
287
306
  "name": "Python Debugger: Worker",
288
307
  "type": "debugpy",
@@ -303,6 +322,7 @@ Note that the Qontract Reconcile container will not start running until it is co
303
322
  "configurations": [
304
323
  "Python Debugger: Reconcile",
305
324
  "Python Debugger: Api",
325
+ "Python Debugger: Subscriber",
306
326
  "Python Debugger: Worker"
307
327
  ],
308
328
  "stopAll": true,
@@ -132,6 +132,7 @@ An environment specifies app-interface instance settings, e.g., **dev** vs. **pr
132
132
  | container_platform | Default Docker container platform for all images | linux/amd64 |
133
133
  | gitlab_pr_submitter_queue_url | Gitlab pr submitter queue url | |
134
134
  | run_qontract_api | Run qontract-api container | false |
135
+ | run_qontract_api_subscriber | Run qontract-api-subscriber container | false |
135
136
  | run_qontract_api_worker | Run qontract-api-worker container | false |
136
137
  | run_cache | Run cache (Redis) container | false |
137
138
  | run_qontract_reconcile | Run qontract-reconcile container | true |
@@ -195,6 +196,11 @@ The command line flag takes precedence over any configuration you might have in
195
196
  | qontract_api_container_platform | Qontract-api container platform | Default from [environment](#environment-settings) |
196
197
  | qontract_api_compose_file | Qontract-api docker-compose file template | `api.yml.j2` |
197
198
  | qontract_api_debugger_port | Debugger port for qontract-api | `5679` |
199
+ | qontract_api_subscriber_build_image | Build qontract-api-subscriber image | `true` |
200
+ | qontract_api_subscriber_image | Qontract-api-subscriber image | `quay.io/redhat-services-prod/.../qontract-api-master:latest` |
201
+ | qontract_api_subscriber_container_platform | Qontract-api-subscriber container platform | Default from [environment](#environment-settings) |
202
+ | qontract_api_subscriber_compose_file | Qontract-api-subscriber docker-compose file template | `subscriber.yml.j2` |
203
+ | qontract_api_subscriber_debugger_port | Debugger port for qontract-api-subscriber | `5681` |
198
204
  | qontract_api_worker_build_image | Build qontract-api-worker image | `true` |
199
205
  | qontract_api_worker_image | Qontract-api-worker image | `quay.io/redhat-services-prod/.../qontract-api-worker-master:latest` |
200
206
  | qontract_api_worker_container_platform | Qontract-api-worker container platform | Default from [environment](#environment-settings) |
@@ -262,6 +268,19 @@ Note that the Qontract Reconcile container will not start running until it is co
262
268
  "enable": true
263
269
  }
264
270
  },
271
+ {
272
+ "name": "Python Debugger: Subscriber",
273
+ "type": "debugpy",
274
+ "request": "attach",
275
+ "connect": { "host": "localhost", "port": 5681 },
276
+ "pathMappings": [
277
+ { "localRoot": "${workspaceFolder}", "remoteRoot": "/opt/app-root/src" }
278
+ ],
279
+ "justMyCode": true,
280
+ "autoReload": {
281
+ "enable": true
282
+ }
283
+ },
265
284
  {
266
285
  "name": "Python Debugger: Worker",
267
286
  "type": "debugpy",
@@ -282,6 +301,7 @@ Note that the Qontract Reconcile container will not start running until it is co
282
301
  "configurations": [
283
302
  "Python Debugger: Reconcile",
284
303
  "Python Debugger: Api",
304
+ "Python Debugger: Subscriber",
285
305
  "Python Debugger: Worker"
286
306
  ],
287
307
  "stopAll": true,
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "qontract-development-cli"
3
- version = "0.16.0"
3
+ version = "0.17.1"
4
4
  description = "Helper tool for qontract-reconcile development"
5
5
  authors = [{ name = "Christian Assing", email = "cassing@redhat.com" }]
6
6
  license = { text = "MIT" }
@@ -13,15 +13,15 @@ dependencies = [
13
13
  "pydantic ~=2.9",
14
14
  "pydantic-settings ~=2.6",
15
15
  "pyyaml ~=6.0.2",
16
- "rich ~=14.0",
17
- "typer ~=0.21.0",
16
+ "rich ~=15.0",
17
+ "typer ~=0.25.1",
18
18
  "watchfiles ~=1.1.0",
19
19
  ]
20
20
 
21
21
  [dependency-groups]
22
22
  dev = [
23
23
  # dev dependencies
24
- "mypy ~=1.13",
24
+ "mypy ~=2.0",
25
25
  "ruff ~=0.7",
26
26
  "types-pyyaml ~=6.0",
27
27
  ]
@@ -269,6 +269,7 @@ def run( # noqa: C901, PLR0912, PLR0913, PLR0915
269
269
  cache=env.settings.run_cache,
270
270
  reconcile=env.settings.run_qontract_reconcile,
271
271
  server=env.settings.run_qontract_server,
272
+ subscriber=env.settings.run_qontract_api_subscriber,
272
273
  vault=env.settings.run_vault,
273
274
  worker=env.settings.run_qontract_api_worker,
274
275
  )
@@ -18,6 +18,7 @@ class EnvSettings(BaseModel):
18
18
  container_platform: str = "linux/amd64"
19
19
  gitlab_pr_submitter_queue_url: str = ""
20
20
  run_qontract_api: bool = False
21
+ run_qontract_api_subscriber: bool = False
21
22
  run_qontract_api_worker: bool = False
22
23
  run_cache: bool = False
23
24
  run_qontract_reconcile: bool = True
@@ -50,9 +51,16 @@ class ProfileSettings(BaseModel):
50
51
  qontract_api_compose_file: str = "api.yml.j2"
51
52
  qontract_api_debugger_port: int = 5679
52
53
 
54
+ # api-subscriber
55
+ qontract_api_subscriber_build_image: bool = True
56
+ qontract_api_subscriber_image: str = "quay.io/redhat-services-prod/app-sre-tenant/qontract-reconcile-master/qontract-api-master:latest"
57
+ qontract_api_subscriber_container_platform: str | None = None
58
+ qontract_api_subscriber_compose_file: str = "subscriber.yml.j2"
59
+ qontract_api_subscriber_debugger_port: int = 5681
60
+
53
61
  # api-worker
54
62
  qontract_api_worker_build_image: bool = True
55
- qontract_api_worker_image: str = "quay.io/redhat-services-prod/app-sre-tenant/qontract-reconcile-master/qontract-api-worker-master:latest"
63
+ qontract_api_worker_image: str = "quay.io/redhat-services-prod/app-sre-tenant/qontract-reconcile-master/qontract-api-master:latest"
56
64
  qontract_api_worker_container_platform: str | None = None
57
65
  qontract_api_worker_compose_file: str = "worker.yml.j2"
58
66
  qontract_api_worker_debugger_port: int = 5680
@@ -119,10 +127,12 @@ class ProfileSettings(BaseModel):
119
127
  cache: bool,
120
128
  reconcile: bool,
121
129
  server: bool,
130
+ subscriber: bool,
122
131
  vault: bool,
123
132
  worker: bool,
124
133
  ) -> list[str]:
125
134
  files = [self.qontract_api_compose_file] if api else []
135
+ files += [self.qontract_api_subscriber_compose_file] if subscriber else []
126
136
  files += [self.qontract_api_worker_compose_file] if worker else []
127
137
  files += [self.cache_compose_file] if cache else []
128
138
  files += [self.qontract_reconcile_compose_file] if reconcile else []
@@ -21,6 +21,15 @@ _docker_compose_bin = (
21
21
  )
22
22
 
23
23
 
24
+ def _compose_base_cmd(compose_file: Path) -> list[str]:
25
+ """Build the base docker compose command with main and override files."""
26
+ cmd = [*_docker_compose_bin, "-f", str(compose_file)]
27
+ override = compose_file.parent / "compose.override.yml"
28
+ if override.exists():
29
+ cmd.extend(["-f", str(override)])
30
+ return cmd
31
+
32
+
24
33
  def compose_up(
25
34
  compose_file: Path,
26
35
  *,
@@ -29,7 +38,7 @@ def compose_up(
29
38
  build: bool = False,
30
39
  ) -> None:
31
40
  log.info("Starting all containers")
32
- compose_cmd = [*_docker_compose_bin, "-f", str(compose_file), "up", "-d"]
41
+ compose_cmd = [*_compose_base_cmd(compose_file), "up", "-d"]
33
42
  if force_recreate:
34
43
  compose_cmd.append("--force-recreate")
35
44
  if remove_orphan:
@@ -41,7 +50,7 @@ def compose_up(
41
50
 
42
51
  def compose_restart(compose_file: Path, container: str) -> None:
43
52
  log.info(f"Restarting {container} container")
44
- compose_cmd = [*_docker_compose_bin, "-f", str(compose_file), "restart", container]
53
+ compose_cmd = [*_compose_base_cmd(compose_file), "restart", container]
45
54
  subprocess.run(compose_cmd, check=True)
46
55
 
47
56
 
@@ -53,12 +62,12 @@ def container_restart(container: str) -> None:
53
62
 
54
63
  def compose_down(compose_file: Path) -> None:
55
64
  log.info("Stopping all containers")
56
- compose_cmd = [*_docker_compose_bin, "-f", str(compose_file), "down"]
65
+ compose_cmd = [*_compose_base_cmd(compose_file), "down"]
57
66
  subprocess.run(compose_cmd, check=True)
58
67
 
59
68
 
60
69
  def compose_log_tail(compose_file: Path) -> Process:
61
- compose_cmd = [*_docker_compose_bin, "-f", str(compose_file), "logs", "--follow"]
70
+ compose_cmd = [*_compose_base_cmd(compose_file), "logs", "--follow"]
62
71
  p = EndlessProcess(target=subprocess.run, args=(compose_cmd,))
63
72
  p.start()
64
73
  return p
@@ -71,7 +80,7 @@ def kill_log_tail(p: Process, compose_file: Path) -> None:
71
80
  "pkill",
72
81
  "-9",
73
82
  "-f",
74
- " ".join([*_docker_compose_bin, "-f", str(compose_file), "logs"]),
83
+ " ".join([*_compose_base_cmd(compose_file), "logs"]),
75
84
  ],
76
85
  check=False,
77
86
  )
@@ -26,7 +26,6 @@ services:
26
26
 
27
27
  volumes:
28
28
  - {{ profile.settings.qontract_api_path.expanduser().absolute() }}/app.sh:/opt/app-root/src/app.sh:z
29
- - {{ profile.settings.qontract_api_path.expanduser().absolute() }}/.env.yaml:/opt/app-root/src/.env.yaml:z
30
29
  - {{ profile.settings.qontract_api_path.expanduser().absolute() }}/.env:/opt/app-root/src/.env:z
31
30
  - {{ profile.settings.qontract_api_path.expanduser().absolute() }}/qontract_api:/opt/app-root/src/qontract_api/qontract_api:z
32
31
  - {{ profile.settings.qontract_reconcile_path.expanduser().absolute() }}/qontract_utils/qontract_utils:/opt/app-root/src/qontract_utils/qontract_utils:z
@@ -0,0 +1,31 @@
1
+ services:
2
+ # qontract-api (Event Subscriber)
3
+ qontract-api-subscriber:
4
+ container_name: qontract-api-subscriber
5
+ platform: {{ profile.settings.qontract_api_subscriber_container_platform or env.settings.container_platform }}
6
+ {% if profile.settings.qontract_api_subscriber_build_image %}
7
+ build:
8
+ context: {{ profile.settings.qontract_reconcile_path.expanduser().absolute() }}
9
+ dockerfile: {{ profile.settings.qontract_api_path.expanduser().absolute() }}/Dockerfile
10
+ target: debug
11
+ {% else %}
12
+ image: {{ profile.settings.qontract_api_subscriber_image }}
13
+ {% endif %}
14
+
15
+ ports:
16
+ - 8081:8080
17
+ - {{ profile.settings.qontract_api_subscriber_debugger_port }}:5678 # debugpy port
18
+
19
+ environment:
20
+ - QAPI_START_MODE=subscriber
21
+ - QAPI_CACHE_BROKER_URL=redis://cache:6379/0
22
+ # Enable debugpy
23
+ - DEBUGGER_ENABLED={% if profile.settings.debugger %}true{% else %}false{% endif %}
24
+ # Hot reload for development
25
+ - AUTO_RELOAD=1
26
+
27
+ volumes:
28
+ - {{ profile.settings.qontract_api_path.expanduser().absolute() }}/app.sh:/opt/app-root/src/app.sh:z
29
+ - {{ profile.settings.qontract_api_path.expanduser().absolute() }}/.env:/opt/app-root/src/.env:z
30
+ - {{ profile.settings.qontract_api_path.expanduser().absolute() }}/qontract_api:/opt/app-root/src/qontract_api/qontract_api:z
31
+ - {{ profile.settings.qontract_reconcile_path.expanduser().absolute() }}/qontract_utils/qontract_utils:/opt/app-root/src/qontract_utils/qontract_utils:z
@@ -7,13 +7,13 @@ services:
7
7
  build:
8
8
  context: {{ profile.settings.qontract_reconcile_path.expanduser().absolute() }}
9
9
  dockerfile: {{ profile.settings.qontract_api_path.expanduser().absolute() }}/Dockerfile
10
-
11
10
  target: debug
12
11
  {% else %}
13
12
  image: {{ profile.settings.qontract_api_workerimage }}
14
13
  {% endif %}
15
14
 
16
15
  ports:
16
+ - 8000:8000
17
17
  - {{ profile.settings.qontract_api_worker_debugger_port }}:5678 # debugpy port
18
18
 
19
19
  environment:
@@ -26,7 +26,6 @@ services:
26
26
 
27
27
  volumes:
28
28
  - {{ profile.settings.qontract_api_path.expanduser().absolute() }}/app.sh:/opt/app-root/src/app.sh
29
- - {{ profile.settings.qontract_api_path.expanduser().absolute() }}/.env.yaml:/opt/app-root/src/.env.yaml
30
29
  - {{ profile.settings.qontract_api_path.expanduser().absolute() }}/.env:/opt/app-root/src/.env
31
30
  - {{ profile.settings.qontract_api_path.expanduser().absolute() }}/qontract_api:/opt/app-root/src/qontract_api/qontract_api
32
31
  - {{ profile.settings.qontract_reconcile_path.expanduser().absolute() }}/qontract_utils/qontract_utils:/opt/app-root/src/qontract_utils/qontract_utils