Repository navigation
feat(no-ticket): get Workspace domains from the v2 API - #476
cloudsmith-iduffy wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Cache partitioning and redirect handling can allow credentials to cross API deployment boundaries.
2 open findings
What changed in this PR
Moves Workspace domain discovery to the configured v2 API, replacing production-specific domain tables.
Changes:
- Adds a shared v2 client and paginated Workspace-domain API.
- Introduces per-API-host domain caching and JSON output version 2.
- Updates credential helpers, tests, dependencies, and documentation.
| File | Description |
|---|---|
uv.lock |
Locks cloudsmith-api 2.0.38. |
pyproject.toml |
Raises the minimum SDK version. |
cloudsmith_cli/credential_helpers/workspace_domains.py |
Implements domain parsing and caching. |
cloudsmith_cli/credential_helpers/pnpm/installer.py |
Uses Workspace discovery. |
cloudsmith_cli/credential_helpers/docker/installer.py |
Uses Workspace discovery. |
cloudsmith_cli/credential_helpers/default_domains.py |
Removes the built-in domain table. |
cloudsmith_cli/credential_helpers/custom_domains.py |
Removes legacy custom-domain discovery. |
cloudsmith_cli/credential_helpers/common.py |
Validates hosts against Workspace domains. |
cloudsmith_cli/credential_helpers/cargo/installer.py |
Uses Workspace discovery. |
cloudsmith_cli/core/tests/test_workspaces.py |
Tests v2 domain requests and pagination. |
cloudsmith_cli/core/api/workspaces.py |
Adds the Workspace domains API wrapper. |
cloudsmith_cli/core/api/v2.py |
Adds the shared v2 HTTP client. |
cloudsmith_cli/core/api/orgs.py |
Removes the legacy domains call. |
cloudsmith_cli/core/api/metadata.py |
Migrates metadata calls to the v2 client. |
cloudsmith_cli/cli/tests/commands/test_workspace_domains.py |
Tests domain parsing and cache isolation. |
cloudsmith_cli/cli/tests/commands/test_domains.py |
Updates command behavior tests. |
cloudsmith_cli/cli/tests/commands/test_default_domains.py |
Removes obsolete table tests. |
cloudsmith_cli/cli/tests/commands/test_custom_domain_precedence.py |
Removes client-side precedence tests. |
cloudsmith_cli/cli/tests/commands/test_credential_helper.py |
Updates helper discovery tests. |
cloudsmith_cli/cli/tests/commands/test_credential_helper_install.py |
Updates installer cache tests. |
cloudsmith_cli/cli/commands/domains.py |
Emits API-supplied domains using schema v2. |
CHANGELOG.md |
Documents the breaking behavior changes. |
.oss-scanner/threat_model.md |
Updates the security-sensitive module path. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
4e43950 to
47f388b
Compare
47f388b to
68a1c40
Compare
|
@copilot Can you modify my change so that its not a breaking change? perhaps we can introduce something like a --version 2 flag and introduce a notice for no flag being specified to say it will eventually be like --version 2 ? |
Implemented in 92ffe0c (test cleanup in 7c92e81).
1,547 non-integration tests passed; hooks passed and CodeQL reports no alerts. Existing repository-wide type-check diagnostics remain. |
|
@copilot can we modify the v1 behaviour slightly? Use the new api but keep the same format adding null fields if the data isn't available. |
Implemented in 7c12c8c.
1,552 non-integration tests passed, along with hooks and command type checking. CodeQL reports no alerts. |
7c12c8c to
5378e7a
Compare
5378e7a to
bc2f866
Compare
|
I squashed the branch into one commit on top of master and removed the |
bc2f866 to
b114ee8
Compare
b114ee8 to
484e7eb
Compare
484e7eb to
0932221
Compare
0932221 to
d0e491f
Compare
d0e491f to
78a2ab3
Compare
78a2ab3 to
3a6e200
Compare
3a6e200 to
d948a88
Compare
The CLI kept a table of Cloudsmith hostnames. That table pinned the CLI
to the production hosts. The CLI now gets the domains of a Workspace
from GET /v2/workspaces/{workspace}/domains/ on the configured API host.
The answer includes the Cloudsmith-owned hosts, in preference order.
- Remove the built-in hostname table and the [domains] section in
config.ini.
- Keep version 1 of the domains list JSON document. Set primary and
created_at to null, because the API does not give them.
- Without a Workspace, domains list uses the cached domains. If no
domains are cached, it gets the domains of a Workspace that the
credential is a member of.
- Name the domain cache after the full API base URL, so two deployments
on one hostname do not share a cache.
- Put the org in the Terraform token for every host that the API lists
as Cloudsmith-owned, not only for *.cloudsmith.io hosts.
- Make the credential helper installers configure the Cloudsmith-owned
hosts that the API lists. They use their default host only when they
cannot get the domains.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d948a88 to
49dfad5
Compare

Description
The CLI kept its own table of Cloudsmith hostnames, which pinned it to production. It now gets the domains of a Workspace from the configured API host with
GET /v2/workspaces/{workspace}/domains/. The answer holds the Cloudsmith-owned hosts and the custom domains, in preference order.domains listkeeps its version 1 JSON shape.primaryandcreated_atare nownull, because the API does not give them.domains listuses cached domains, or the domains of a Workspace that the credential is a member of.default_domains.py) and the[domains]section inconfig.iniare removed.custom_domains.pybecomesdomains.py.Type of Change
Additional Notes
Tested end to end on production, without changes to the consumers: pip through cloudsmith-keyring, a Maven build through cloudsmith-maven-tools, and
terraform initthrough the Terraform helper. Each authenticated on Cloudsmith-owned hosts and on custom domains. A second API host returned its own hosts only.The
[domains]section in the cloudsmith-docs CLI page needs removing after release.🤖 Generated with Claude Code