toolforge-components-cli 0.0.17__tar.gz → 0.0.18__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.
- {toolforge_components_cli-0.0.17 → toolforge_components_cli-0.0.18}/PKG-INFO +1 -1
- {toolforge_components_cli-0.0.17 → toolforge_components_cli-0.0.18}/pyproject.toml +1 -1
- {toolforge_components_cli-0.0.17 → toolforge_components_cli-0.0.18}/toolforge_components_cli/cli.py +32 -5
- {toolforge_components_cli-0.0.17 → toolforge_components_cli-0.0.18}/LICENSE +0 -0
- {toolforge_components_cli-0.0.17 → toolforge_components_cli-0.0.18}/README.md +0 -0
- {toolforge_components_cli-0.0.17 → toolforge_components_cli-0.0.18}/toolforge_components_cli/__init__.py +0 -0
- {toolforge_components_cli-0.0.17 → toolforge_components_cli-0.0.18}/toolforge_components_cli/components.py +0 -0
- {toolforge_components_cli-0.0.17 → toolforge_components_cli-0.0.18}/toolforge_components_cli/config.py +0 -0
{toolforge_components_cli-0.0.17 → toolforge_components_cli-0.0.18}/toolforge_components_cli/cli.py
RENAMED
|
@@ -42,6 +42,8 @@ TOKEN_EXISTS_MSG = """A valid deployment token already exists. You can:
|
|
|
42
42
|
# this seems to be enough to show the 'job <> is already up to date' message for most jobs and not too long to be
|
|
43
43
|
# too annoying
|
|
44
44
|
LONG_STATUS_WIDTH = 45
|
|
45
|
+
# Keep freeform descriptions from making the deployment list excessively wide.
|
|
46
|
+
DESCRIPTION_WIDTH = 45
|
|
45
47
|
|
|
46
48
|
|
|
47
49
|
def handle_error(e: Exception, debug: bool = False) -> None:
|
|
@@ -100,6 +102,10 @@ def _display_deployment(deployment_data: dict, as_json: bool, prefix: str = "")
|
|
|
100
102
|
click.echo(
|
|
101
103
|
click.style("Created: ", bold=True) + deployment_data["creation_time"]
|
|
102
104
|
)
|
|
105
|
+
if deployment_data.get("description"):
|
|
106
|
+
click.echo(
|
|
107
|
+
click.style("Description: ", bold=True) + deployment_data["description"]
|
|
108
|
+
)
|
|
103
109
|
click.echo(
|
|
104
110
|
click.style("Status: ", bold=True)
|
|
105
111
|
+ _format_status(deployment_data.get("status", "unknown"))
|
|
@@ -394,6 +400,11 @@ def deployment():
|
|
|
394
400
|
"(ex. delete + create the continuous job)"
|
|
395
401
|
),
|
|
396
402
|
)
|
|
403
|
+
@click.option(
|
|
404
|
+
"--description",
|
|
405
|
+
type=str,
|
|
406
|
+
help="Human-readable context describing what is being deployed and why.",
|
|
407
|
+
)
|
|
397
408
|
@click.option(
|
|
398
409
|
"--json",
|
|
399
410
|
"as_json",
|
|
@@ -401,7 +412,13 @@ def deployment():
|
|
|
401
412
|
help="If set, will output in JSON format",
|
|
402
413
|
)
|
|
403
414
|
@click.pass_context
|
|
404
|
-
def deployment_create(
|
|
415
|
+
def deployment_create(
|
|
416
|
+
ctx,
|
|
417
|
+
force_build: bool,
|
|
418
|
+
force_run: bool,
|
|
419
|
+
description: str | None,
|
|
420
|
+
as_json: bool,
|
|
421
|
+
) -> None:
|
|
405
422
|
components_client = ctx.obj["components_client"]
|
|
406
423
|
display_messages = not as_json
|
|
407
424
|
|
|
@@ -411,9 +428,14 @@ def deployment_create(ctx, force_build: bool, force_run: bool, as_json: bool) ->
|
|
|
411
428
|
if force_run:
|
|
412
429
|
query_params["force-run"] = "true"
|
|
413
430
|
|
|
414
|
-
|
|
415
|
-
"
|
|
416
|
-
|
|
431
|
+
request_kwargs: dict[str, Any] = {
|
|
432
|
+
"params": query_params,
|
|
433
|
+
"display_messages": display_messages,
|
|
434
|
+
}
|
|
435
|
+
if description is not None:
|
|
436
|
+
request_kwargs["json"] = {"description": description}
|
|
437
|
+
|
|
438
|
+
response = components_client.post("/deployment", **request_kwargs)
|
|
417
439
|
|
|
418
440
|
if as_json:
|
|
419
441
|
click.echo(json.dumps(response, indent=4))
|
|
@@ -421,6 +443,8 @@ def deployment_create(ctx, force_build: bool, force_run: bool, as_json: bool) ->
|
|
|
421
443
|
deployment_data = response.get("data", {})
|
|
422
444
|
click.echo(f"Deployment ID: {deployment_data.get('deploy_id')}")
|
|
423
445
|
click.echo(f"Created: {deployment_data.get('creation_time')}")
|
|
446
|
+
if deployment_data.get("description"):
|
|
447
|
+
click.echo(f"Description: {deployment_data['description']}")
|
|
424
448
|
if deployment_data.get("builds"):
|
|
425
449
|
click.echo("\nBuilds:")
|
|
426
450
|
for component, build in deployment_data["builds"].items():
|
|
@@ -499,6 +523,9 @@ def deployment_list(ctx, as_json: bool) -> None:
|
|
|
499
523
|
[
|
|
500
524
|
deployment["deploy_id"],
|
|
501
525
|
deployment["creation_time"],
|
|
526
|
+
textwrap.shorten(
|
|
527
|
+
deployment.get("description", ""), width=DESCRIPTION_WIDTH
|
|
528
|
+
),
|
|
502
529
|
_format_status(deployment.get("status", "unknown")),
|
|
503
530
|
_format_builds(deployment.get("builds", {})),
|
|
504
531
|
_format_runs(deployment.get("runs", {})),
|
|
@@ -509,7 +536,7 @@ def deployment_list(ctx, as_json: bool) -> None:
|
|
|
509
536
|
tabulate(
|
|
510
537
|
formatted_deployments,
|
|
511
538
|
headers=_format_headers(
|
|
512
|
-
["ID", "Creation time", "Status", "Builds", "Runs"]
|
|
539
|
+
["ID", "Creation time", "Description", "Status", "Builds", "Runs"]
|
|
513
540
|
),
|
|
514
541
|
)
|
|
515
542
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|