Uh oh!
There was an error while loading. Please reload this page.
feat: add generic OIDC detector - #304
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a generic, env-var based OIDC detector so the CLI can exchange an injected OIDC JWT (e.g., from Jenkins or custom CI/CD) when no vendor-specific detector matches.
Changes:
- Introduces
GenericDetectorthat readsCLOUDSMITH_OIDC_TOKENfor OIDC token exchange. - Registers the generic detector after existing detectors so it acts as a fallback.
- Adds unit tests covering presence/absence of the env var and token retrieval behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
cloudsmith_cli/core/credentials/oidc/detectors/generic.py | Adds a new fallback detector that sources an OIDC JWT from CLOUDSMITH_OIDC_TOKEN. |
cloudsmith_cli/core/credentials/oidc/detectors/__init__.py | Registers the new detector in the detector chain. |
cloudsmith_cli/core/tests/test_generic_detector.py | Adds tests for generic detector detection and token retrieval behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
9213c8e to
97ada44CompareUh oh!
There was an error while loading. Please reload this page.
Add a generic fallback to OIDC credential auto-discovery. When no dedicated environment is detected, the CLI reads an OIDC token from the CLOUDSMITH_OIDC_TOKEN environment variable (useful for Jenkins or any custom CI/CD) and exchanges it for a Cloudsmith access token. Whitespace-only values are treated as unset, and the token is stripped before use. Registered last so a dedicated environment is always preferred when present. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
97ada44 to
d402dcbCompareUh oh!
There was an error while loading. Please reload this page.
* origin/master: feat: add generic OIDC detector (#304) # Conflicts: # cloudsmith_cli/core/credentials/oidc/detectors/__init__.py
…r-controls * origin/master: feat: add generic OIDC detector (#304) # Conflicts: # CHANGELOG.md # README.md # cloudsmith_cli/core/credentials/oidc/detectors/__init__.py # cloudsmith_cli/core/credentials/oidc/detectors/generic.py
* origin/master: feat: add generic OIDC detector (#304) # Conflicts: # cloudsmith_cli/core/credentials/oidc/detectors/__init__.py
What
Adds a generic fallback OIDC detector that reads an OIDC JWT from the
CLOUDSMITH_OIDC_TOKENenvironment variable.This supports:
How
GenericDetectorincloudsmith_cli/core/credentials/oidc/detectors/generic.py, following the sameEnvironmentDetectorpattern as the AWS detector.detect()returnsTruewhenCLOUDSMITH_OIDC_TOKENis set and non-empty;get_token()returns the value or raisesValueErrorwith guidance if unset._DETECTORSso vendor-specific detectors (AWS, etc.) take precedence — the generic detector is a catch-all fallback.Naming note
The environment variable name
CLOUDSMITH_OIDC_TOKENwas considered against alternatives (CLOUDSMITH_OIDC_ID_TOKEN,CLOUDSMITH_OIDC_JWT) since "TOKEN" could be misread as a directly-usable API token rather than a JWT to be exchanged. The shorterCLOUDSMITH_OIDC_TOKENwas chosen; theget_token()error message clarifies it is "the OIDC JWT to exchange for a Cloudsmith token."Testing
cloudsmith_cli/core/tests/test_generic_detector.py(TDD — written first), mirroring the Bitbucket detector tests: detection (present / unset / empty) and token retrieval (returns / raises).🤖 Generated with Claude Code