toolforge-components-cli 0.0.9__tar.gz → 0.0.11__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.9
3
+ Version: 0.0.11
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.9"
3
+ version = "0.0.11"
4
4
  description = "Toolforge components client"
5
5
  authors = ["Slavina Stefanova <sstefanova@wikimedia.org>"]
6
6
  license = "GPLv3"
@@ -6,6 +6,7 @@ import logging
6
6
  import os
7
7
  import subprocess
8
8
  import sys
9
+ import textwrap
9
10
  from textwrap import indent
10
11
  from typing import Any
11
12
 
@@ -39,6 +40,9 @@ TOKEN_EXISTS_MSG = """A valid deployment token already exists. You can:
39
40
  - Use 'deploy-token show' to see the current token
40
41
  - Use 'deploy-token refresh' to create a new token (this will invalidate the current one)
41
42
  - Use 'deploy-token delete' to remove the current token"""
43
+ # this seems to be enough to show the 'job <> is already up to date' message for most jobs and not too long to be
44
+ # too annoying
45
+ LONG_STATUS_WIDTH = 45
42
46
 
43
47
 
44
48
  def handle_error(e: Exception, debug: bool = False) -> None:
@@ -110,7 +114,7 @@ def _display_deployment(deployment_data: dict, as_json: bool, prefix: str = "")
110
114
  click.echo("\n" + click.style("Builds:", bold=True))
111
115
  for component, build in deployment_data["builds"].items():
112
116
  click.echo(
113
- f" {component}({_format_status(build['build_status'])}): {build['build_id']}"
117
+ f" {component}({_format_status(build['build_status'])}): id:{build['build_id']} {build.get('build_long_status', '')}"
114
118
  )
115
119
 
116
120
  if deployment_data.get("runs"):
@@ -435,8 +439,12 @@ def _format_headers(headers: list[str]) -> list[str]:
435
439
  def _format_builds(builds: dict[str, dict[str, Any]]) -> str:
436
440
  builds_strings: list[str] = []
437
441
  for component_name, build_info in builds.items():
442
+ short_status = _format_status(build_info["build_status"])
443
+ long_status = textwrap.shorten(
444
+ build_info.get("build_long_status", ""), width=LONG_STATUS_WIDTH
445
+ )
438
446
  builds_strings.append(
439
- f"{component_name}({_format_status(build_info['build_status'])}): {build_info['build_id']}"
447
+ f"{component_name}({short_status}): id:{build_info['build_id']} {long_status}"
440
448
  )
441
449
  return "\n".join(builds_strings)
442
450
 
@@ -444,9 +452,11 @@ def _format_builds(builds: dict[str, dict[str, Any]]) -> str:
444
452
  def _format_runs(runs: dict[str, dict[str, Any]]) -> str:
445
453
  runs_strings: list[str] = []
446
454
  for component_name, run_info in runs.items():
447
- runs_strings.append(
448
- f"{component_name}({_format_status(run_info['run_status'])}): {run_info.get('run_long_status', '')}"
455
+ short_status = _format_status(run_info["run_status"])
456
+ long_status = textwrap.shorten(
457
+ run_info.get("run_long_status", ""), width=LONG_STATUS_WIDTH
449
458
  )
459
+ runs_strings.append(f"{component_name}({short_status}): {long_status}")
450
460
  return "\n".join(runs_strings)
451
461
 
452
462