Skip to content
Open
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: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed

- The help of `cloudsmith credential-helper`, `credential-helper install` and `credential-helper uninstall` now lists every helper, including `maven`, `gradle` and `sbt`, and has examples for Maven. The help also explains that Maven, Gradle and sbt have no runtime command of their own. (ENG-15733)

## [1.31.0] - 2026-11-11

### Added
Expand Down
20 changes: 17 additions & 3 deletions cloudsmith_cli/cli/commands/credential_helper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@ def credential_helper():
"""
Credential helpers for package managers.

These commands provide credentials for package managers like Docker.
Use ``install`` to set up the on-PATH launcher and configure the package
manager automatically, or run the runtime command directly for debugging.
These commands provide credentials for package managers. Use ``install``
to set up a helper and configure the package manager automatically, and
``list`` to see every helper and whether it is installed.

\b
Helpers: cargo, docker, gradle, maven, pnpm, sbt, terraform.

Docker, pnpm, cargo and Terraform call the runtime command of the same
name, which you can also run directly for debugging. Maven, Gradle and
sbt load a Cloudsmith extension or plugin that gets credentials from
``generic``, so they have no runtime command of their own.

Examples:

Expand All @@ -37,6 +45,12 @@ def credential_helper():
\b
# Install cargo credential helper
$ cloudsmith credential-helper install cargo
\b
# Install the Maven extension (also: gradle, sbt)
$ cloudsmith credential-helper install maven
\b
# List the helpers and their installation status
$ cloudsmith credential-helper list
\b
# Test Docker credential helper directly
$ echo "docker.cloudsmith.io" | cloudsmith credential-helper docker
Expand Down
14 changes: 12 additions & 2 deletions cloudsmith_cli/cli/commands/credential_helper/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
contexts = []
while ctx is not None:
contexts.insert(0, ctx)
ctx = ctx.parent

Check failure on line 217 in cloudsmith_cli/cli/commands/credential_helper/manage.py

View workflow job for this annotation

GitHub Actions / ty

ty (invalid-assignment)

cloudsmith_cli/cli/commands/credential_helper/manage.py:217:15: invalid-assignment: Object of type `Context | None` is not assignable to `Context` cloudsmith_cli/cli/commands/credential_helper/manage.py:204:38: Declared type info: element `None` of union `Context | None` is not assignable to `Context`

supplied = (ParameterSource.COMMANDLINE, ParameterSource.ENVIRONMENT)
settings = {}
Expand Down Expand Up @@ -381,7 +381,8 @@
) -> None:
"""Install a credential helper launcher and configure the package manager.

HELPER is the name of the credential helper to install (e.g. ``docker``, ``pnpm``).
HELPER is the name of the credential helper to install: one of ``cargo``,
``docker``, ``gradle``, ``maven``, ``pnpm``, ``sbt`` or ``terraform``.

Important for pnpm: The tokenHelper directive is only honored in the
user-level ~/.npmrc file, not in a project-level .npmrc. This is a pnpm
Expand Down Expand Up @@ -410,6 +411,10 @@
# Terraform: bake the repository into the terraformrc args so
# `terraform init` needs no CLOUDSMITH_REPO env var
$ cloudsmith credential-helper install terraform -w acme --repo my-repo

\b
# Maven: set up only the Maven project in the current directory
$ cloudsmith credential-helper install maven --local

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd drop the --local here ideally we want that to be for power users that read the docs on docs.cloudsmith.com rather than the default.

"""
installer = _get_installer(helper)
helper_options = _helper_options(ctx, helper)
Expand Down Expand Up @@ -536,7 +541,8 @@
) -> None:
"""Uninstall a credential helper launcher and remove its config entries.

HELPER is the name of the credential helper to uninstall (e.g. ``docker``).
HELPER is the name of the credential helper to uninstall: one of ``cargo``,
``docker``, ``gradle``, ``maven``, ``pnpm``, ``sbt`` or ``terraform``.

Examples:

Expand All @@ -547,6 +553,10 @@
\b
# Preview without making changes
$ cloudsmith credential-helper uninstall docker --dry-run

\b
# Uninstall the Maven extension
$ cloudsmith credential-helper uninstall maven
"""
installer = _get_installer(helper)
try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,20 @@ def test_manage_cli_unknown_helper_exits_nonzero(runner):
assert result.exit_code != 0


@pytest.mark.parametrize("args", [[], ["install"], ["uninstall"]])
def test_help_names_every_helper(runner, args):
"""The help of the group, install and uninstall names every registered helper."""
from ....cli.commands.credential_helper.manage import _INSTALLERS

result = runner.invoke(
credential_helper, [*args, "--help"], terminal_width=200, catch_exceptions=False
)

assert result.exit_code == 0
missing = [name for name in _INSTALLERS if name not in result.output]
assert not missing, f"--help does not mention: {missing}"
Comment on lines +1133 to +1134


# ---------------------------------------------------------------------------
# 13. manage CLI dry-run
# ---------------------------------------------------------------------------
Expand Down
Loading