feat: add generic OIDC detector#304
Merged
Merged
Conversation
Contributor
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.
9213c8e to
97ada44
Compare
2 tasks
BartoszBlizniak
approved these changes
Jun 10, 2026
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
d402dcb
Compare
cloudsmith-iduffy
added a commit
that referenced
this pull request
Jun 10, 2026
* origin/master: feat: add generic OIDC detector (#304) # Conflicts: # cloudsmith_cli/core/credentials/oidc/detectors/__init__.py
cloudsmith-iduffy
added a commit
that referenced
this pull request
Jun 10, 2026
…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
cloudsmith-iduffy
added a commit
that referenced
this pull request
Jun 10, 2026
* origin/master: feat: add generic OIDC detector (#304) # Conflicts: # cloudsmith_cli/core/credentials/oidc/detectors/__init__.py
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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