toolforge-components-cli 0.0.5__tar.gz → 0.0.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: toolforge-components-cli
3
- Version: 0.0.5
3
+ Version: 0.0.6
4
4
  Summary: Toolforge components client
5
5
  License: GPLv3
6
6
  Author: Slavina Stefanova
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "toolforge-components-cli"
3
- version = "0.0.5"
3
+ version = "0.0.6"
4
4
  description = "Toolforge components client"
5
5
  authors = ["Slavina Stefanova <sstefanova@wikimedia.org>"]
6
6
  license = "GPLv3"
@@ -107,14 +107,19 @@ def _display_deployment(deployment_data: dict, as_json: bool, prefix: str = "")
107
107
  + indent(text=deployment_data.get("long_status", "unknown"), prefix=" ")
108
108
  )
109
109
  if deployment_data.get("builds"):
110
- click.echo(
111
- "\n" + click.style("Builds:" if not prefix else "Builds:", bold=True)
112
- )
110
+ click.echo("\n" + click.style("Builds:", bold=True))
113
111
  for component, build in deployment_data["builds"].items():
114
112
  click.echo(
115
113
  f" {component}({_format_status(build['build_status'])}): {build['build_id']}"
116
114
  )
117
115
 
116
+ if deployment_data.get("runs"):
117
+ click.echo("\n" + click.style("Runs:", bold=True))
118
+ for component, run in deployment_data["runs"].items():
119
+ click.echo(
120
+ f" {component}({_format_status(run['run_status'])}): {run.get('run_long_status', '')}"
121
+ )
122
+
118
123
 
119
124
  @click.version_option(prog_name="Toolforge Components CLI")
120
125
  @click.group(
@@ -372,6 +377,12 @@ def deployment_create(ctx, as_json: bool) -> None:
372
377
  click.echo(
373
378
  f" {component}({_format_status(build['build_status'])}): {build['build_id']}"
374
379
  )
380
+ if deployment_data.get("runs"):
381
+ click.echo("\nRuns:")
382
+ for component, run in deployment_data["runs"].items():
383
+ click.echo(
384
+ f" {component}({_format_status(run['run_status'])}): {run.get('run_long_status', '')}"
385
+ )
375
386
 
376
387
 
377
388
  def _format_headers(headers: list[str]) -> list[str]:
@@ -387,11 +398,20 @@ def _format_builds(builds: dict[str, dict[str, Any]]) -> str:
387
398
  return "\n".join(builds_strings)
388
399
 
389
400
 
401
+ def _format_runs(runs: dict[str, dict[str, Any]]) -> str:
402
+ runs_strings: list[str] = []
403
+ for component_name, run_info in runs.items():
404
+ runs_strings.append(
405
+ f"{component_name}({_format_status(run_info['run_status'])}): {run_info.get('run_long_status', '')}"
406
+ )
407
+ return "\n".join(runs_strings)
408
+
409
+
390
410
  def _format_status(status: str) -> str:
391
411
  fg_color = "yellow"
392
412
 
393
413
  if status in ("running", "pending"):
394
- fg_color = "white"
414
+ fg_color = "yellow"
395
415
  elif status == "failed":
396
416
  fg_color = "red"
397
417
  elif status == "successful":
@@ -424,14 +444,17 @@ def deployment_list(ctx, as_json: bool) -> None:
424
444
  deployment["deploy_id"],
425
445
  deployment["creation_time"],
426
446
  _format_status(deployment.get("status", "unknown")),
427
- _format_builds(deployment.get("builds", [])),
447
+ _format_builds(deployment.get("builds", {})),
448
+ _format_runs(deployment.get("runs", {})),
428
449
  ]
429
450
  for deployment in deployments
430
451
  ]
431
452
  click.echo(
432
453
  tabulate(
433
454
  formatted_deployments,
434
- headers=_format_headers(["ID", "Creation time", "Status", "Builds"]),
455
+ headers=_format_headers(
456
+ ["ID", "Creation time", "Status", "Builds", "Runs"]
457
+ ),
435
458
  )
436
459
  )
437
460