feat: add CircleCI OIDC detector#305
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
- Adds CircleCI support to the CLI’s OIDC credential auto-discovery so CircleCI jobs can exchange a CircleCI-provided OIDC JWT for a short-lived Cloudsmith API token (avoiding static credentials).
Changes:
- Introduces a new
CircleCIDetectorthat readsCIRCLE_OIDC_TOKEN_V2(preferred) orCIRCLE_OIDC_TOKEN. - Registers CircleCI first in the OIDC detector chain.
- Adds unit tests for detection/token selection and documents the feature in the changelog.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cloudsmith_cli/core/credentials/oidc/detectors/circleci.py | Adds CircleCI environment detection and token retrieval logic for OIDC. |
| cloudsmith_cli/core/credentials/oidc/detectors/init.py | Registers the CircleCI detector in the environment detection chain. |
| cloudsmith_cli/core/tests/test_circleci_detector.py | Adds unit tests validating detection and token selection behavior. |
| CHANGELOG.md | Documents the new CircleCI OIDC auto-discovery capability. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add CircleCI to OIDC credential auto-discovery. When running in CircleCI, the CLI reads the OIDC token from the CIRCLE_OIDC_TOKEN_V2 (preferred) or CIRCLE_OIDC_TOKEN environment variable and exchanges it for a Cloudsmith access token. Works out of the box with no extra dependencies. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1a58cf6 to
af314d7
Compare
BartoszBlizniak
approved these changes
Jun 10, 2026
5d44cef to
bf7e041
Compare
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
bf7e041 to
b38130b
Compare
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.
Summary
Adds CircleCI to the OIDC credential auto-discovery chain. When running in CircleCI, the CLI reads the OIDC token from
CIRCLE_OIDC_TOKEN_V2(preferred) orCIRCLE_OIDC_TOKENand exchanges it for a short-lived Cloudsmith API token — no static credentials required.CircleCIDetector(cloudsmith_cli/core/credentials/oidc/detectors/circleci.py), registered first in the detector chain.CIRCLECI == "true"plus presence of a token env var.Verification
Verified end-to-end against a live public CircleCI pipeline (
cloudsmith-iduffy/cloudsmith-cli-oidc-test): detection → OIDC token fetch → Cloudsmith exchange → authenticatedwhoami/list reposround-trip succeeds.OIDC token claims observed:
iss:https://oidc.circleci.com/org/<org_id>aud:<org_id>(the CircleCI org UUID; not customizable for the preset env-var token)sub(V2):org/<org_id>/project/<project_id>/user/<user_id>/vcs-origin/<vcs_origin>/vcs-ref/<vcs_ref>Public proof pipeline: https://app.circleci.com/pipelines/github/cloudsmith-iduffy/cloudsmith-cli-oidc-test
🤖 Generated with Claude Code