Skip to content

fix(no-ticket): whoami exits 1 when not authenticated#321

Draft
BartoszBlizniak wants to merge 1 commit into
masterfrom
fix/whoami-exit-code
Draft

fix(no-ticket): whoami exits 1 when not authenticated#321
BartoszBlizniak wants to merge 1 commit into
masterfrom
fix/whoami-exit-code

Conversation

@BartoszBlizniak

Copy link
Copy Markdown
Member

Description

cloudsmith whoami always exited with code 0, even when the request was anonymous. Scripts and CI pipelines could not rely on the exit code to verify credentials and instead had to parse --output-format json for "is_authenticated": false.

The command now exits with code 1 when is_authenticated is false and 0 when true, across all output formats (human, json, pretty_json).

Includes new tests for the whoami command (none existed previously): authenticated and anonymous cases.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Other (please describe)

Additional Notes

(Release notes for this will be added at the end of merging the draft PRs)
Behavior change — flag in release notes: callers that run whoami while unauthenticated and expect exit 0 will now receive exit 1. This is the intended, correct behavior, since the exit code should reflect authentication status.

The whoami command previously always exited 0, even for anonymous
(unauthenticated) requests, so scripts and CI pipelines had to parse
the JSON output to detect authentication status. It now exits with
code 1 when is_authenticated is false and 0 when true, across all
output formats. Output is unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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