Skip to content

feat: export the CLI-resolved authentication token - #17

Merged
cloudsmith-iduffy merged 1 commit into
mainfrom
feat/export-auth-token
Sep 28, 2026
Merged

cloudsmith-iduffy merged 1 commit into
mainfrom
feat/export-auth-token

Conversation

@cloudsmith-iduffy

@cloudsmith-iduffy cloudsmith-iduffy commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

📄 Summary

A user reports that after the upgrade to @2, they cannot get a Cloudsmith API key to use with other tools. Version @2 keeps the OIDC exchange inside the CLI and removed oidcAuthOnly, so the exchanged token is no longer exported.

This PR adds the opt-in exportAuthToken input. It uses the same credential-helper approach as export-auth-token in cloudsmith-io/cloudsmith-cli-action:

🧪 Type of Change

  • [FIX] Bug fix
  • [NEW] New thing
  • [REFACTOR] Internal changes such as code restructuring or optimization that does not alter functionality
  • [DOC] Documentation-only changes
  • [CHORE] Maintenance, cleanup, or CI configuration

🧪 How Has This Been Tested?

  • npm test locally: 31 of 31 tests pass. New tests cover response validation, OIDC and API-key export, the default-off case, the inherited-token case, verifyAuth token reuse, helper failure, an unsupported response, and the manifest input.
  • The fake cloudsmith fixture now handles credential-helper generic. The new tests that run the fixture are skipped on Windows, like the existing whoami tests.
  • npx tfx-cli@0.23.4 extension create packages version 2.1.0.
  • Tested on a real Azure DevOps agent with CLI 1.21.0 or later.

✅ Checklist

  • I’ve read and followed the CONTRIBUTING.md.
  • I’ve added or updated documentation as needed.
  • I’ve verified the change is tested and works as intended.
  • CI/CD checks pass and do not break existing functionality.
  • My code follows the style guidelines of this project.

Version 2 keeps the OIDC exchange inside the CLI. Pipelines that used
the exchanged token with other tools, such as docker, npm, or pip, lost
the read path that version 1 gave through oidcAuthOnly.

Add the opt-in exportAuthToken input. The task runs
'cloudsmith credential-helper generic' once and validates the version 1
JSON response. It exports the password as the secret variable
CLOUDSMITH_API_KEY and the username as CLOUDSMITH_USERNAME. When
verifyAuth is also set, whoami uses the exported token, so OIDC does
one exchange only. The input requires Cloudsmith CLI 1.21.0 or later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudsmith-iduffy cloudsmith-iduffy changed the title [NEW] feat: export the CLI-resolved authentication token feat: export the CLI-resolved authentication token Sep 24, 2026
@cloudsmith-iduffy
cloudsmith-iduffy marked this pull request as ready for review September 24, 2026 11:39
Copilot AI lite review requested due to automatic review settings September 24, 2026 11:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Add Windows fixture support and run the export tests on Windows.

Review effort: Lite
Findings: None

What changed in this PR

Adds opt-in export of the CLI-resolved Cloudsmith authentication token for use by other Azure Pipelines tools.

Changes:

  • Adds exportAuthToken and credential-helper integration.
  • Exports Cloudsmith API credentials and reuses OIDC tokens.
  • Updates tests, documentation, fixtures, changelog, and version metadata.

The new export tests skip Windows, leaving the flow untested on supported Windows agents.

File Summary
vss-extension.json Updates extension version.
tests/​main.test.js Tests token export and validation behavior.
tests/​fixtures/​fake-installer/​cloudsmith Supports credential-helper test scenarios.
tests/​contract.test.js Validates the manifest input contract.
README.md Documents configuration and usage.
overview.md Updates feature and migration guidance.
cloudsmith-task/​task.json Defines the new input.
cloudsmith-task/​package.json Updates task version.
cloudsmith-task/​package-lock.json Synchronizes lockfile version.
cloudsmith-task/​main.js Resolves and exports credentials.
CHANGELOG.md Records the 2.1.0 feature.
Files not reviewed (1)
  • cloudsmith-task/package-lock.json: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@cloudsmith-iduffy
cloudsmith-iduffy merged commit 3185a5f into main Sep 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants