Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: simplify registry cli #182

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/commands/cluster.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ CLI commands for interacting with the Silverback Platform.
:nested: full
:commands: new, list, info, update, remove

.. click:: silverback._cli:registry_auth
:prog: silverback cluster registry auth
.. click:: silverback._cli:registry
:prog: silverback cluster registry
:nested: full
:commands: new, list, info, update, remove

Expand Down
4 changes: 2 additions & 2 deletions docs/userguides/deploying.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Once you have created all the Variable Group(s) that you need to operate your Bo
## Private Container Registries

If you are using a private container registry to store your images, you will need to provide your bot with the necessary credentials to access it.
First you will need to add your credentials to the cluster with the [`silverback cluster registry auth new`][silverback-cluster-registry-auth-new] command.
First you will need to add your credentials to the cluster with the [`silverback cluster registry new`][silverback-cluster-registry-new] command.

Then you can provide the name of these credentials when creating your bot with the [`silverback cluster bots new`][silverback-cluster-bots-new] or [`silverback cluster bots update`][silverback-cluster-bots-update] commands.

Expand Down Expand Up @@ -198,7 +198,7 @@ TODO: Downloading metrics from your Bot
[silverback-cluster-bots-start]: ../commands/cluster.html#silverback-cluster-bots-start
[silverback-cluster-bots-stop]: ../commands/cluster.html#silverback-cluster-bots-stop
[silverback-cluster-bots-update]: ../commands/cluster.html#silverback-cluster-bots-update
[silverback-cluster-registry-auth-new]: ../commands/cluster.html#silverback-cluster-registry-auth-new
[silverback-cluster-registry-new]: ../commands/cluster.html#silverback-cluster-registry-new
[silverback-cluster-vars]: ../commands/cluster.html#silverback-cluster-vars
[silverback-cluster-vars-info]: ../commands/cluster.html#silverback-cluster-vars-info
[silverback-cluster-vars-list]: ../commands/cluster.html#silverback-cluster-vars-list
Expand Down
15 changes: 5 additions & 10 deletions silverback/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,12 +784,7 @@ def registry():
"""Manage container registry configuration"""


@registry.group(cls=SectionedHelpGroup, name="auth")
def registry_auth():
"""Manage private container registry credentials"""


@registry_auth.command(name="list")
@registry.command(name="list")
@cluster_client
def credentials_list(cluster: "ClusterClient"):
"""List container registry credentials"""
Expand All @@ -801,7 +796,7 @@ def credentials_list(cluster: "ClusterClient"):
click.secho("No registry credentials present in this cluster", bold=True, fg="red")


@registry_auth.command(name="info")
@registry.command(name="info")
@click.argument("name")
@cluster_client
def credentials_info(cluster: "ClusterClient", name: str):
Expand All @@ -813,7 +808,7 @@ def credentials_info(cluster: "ClusterClient", name: str):
click.echo(yaml.safe_dump(creds.model_dump(exclude={"id", "name"})))


@registry_auth.command(name="new")
@registry.command(name="new")
@click.argument("name")
@click.argument("registry")
@cluster_client
Expand All @@ -831,7 +826,7 @@ def credentials_new(cluster: "ClusterClient", name: str, registry: str):
click.echo(yaml.safe_dump(creds.model_dump(exclude={"id"})))


@registry_auth.command(name="update")
@registry.command(name="update")
@click.argument("name")
@click.option("-r", "--registry")
@cluster_client
Expand All @@ -847,7 +842,7 @@ def credentials_update(cluster: "ClusterClient", name: str, registry: str | None
click.echo(yaml.safe_dump(creds.model_dump(exclude={"id"})))


@registry_auth.command(name="remove")
@registry.command(name="remove")
@click.argument("name")
@cluster_client
def credentials_remove(cluster: "ClusterClient", name: str):
Expand Down
Loading