Skip to content

fix: Return errors from view command via RunE in artifact cmd#912

Merged
bupd merged 1 commit into
goharbor:mainfrom
cotishq:fix/artifact-view-rune-error-exit
May 26, 2026
Merged

fix: Return errors from view command via RunE in artifact cmd#912
bupd merged 1 commit into
goharbor:mainfrom
cotishq:fix/artifact-view-rune-error-exit

Conversation

@cotishq

@cotishq cotishq commented May 10, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes command error handling in harbor artifact view so failures are returned to Cobra and the process exits non-zero instead of silently succeeding.

Type of Change

Please select the relevant type.

  • Bug fix
  • New feature
  • Refactor
  • Documentation update
  • Chore / maintenance

Changes

  • Converted artifact view command from Run to RunE in view.go.
  • Replaced log-and-return paths with explicit return fmt.Errorf(...) for parse, prompt, validation, and API failures.
  • Preserved success behavior/output, but now error cases correctly return exit code 1 for script/CI reliability.
  • Before :
Screenshot From 2026-05-10 00-32-55
  • After (fix):
Screenshot From 2026-05-10 13-01-27

Signed-off-by: cotishq <tanishqp101204@gmail.com>
@codecov

codecov Bot commented May 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 8.80%. Comparing base (60ad0bd) to head (36f909c).
⚠️ Report is 159 commits behind head on main.

Files with missing lines Patch % Lines
cmd/harbor/root/artifact/view.go 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             main    #912      +/-   ##
=========================================
- Coverage   10.99%   8.80%   -2.19%     
=========================================
  Files         173     280     +107     
  Lines        8671   13962    +5291     
=========================================
+ Hits          953    1230     +277     
- Misses       7612   12615    +5003     
- Partials      106     117      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@qcserestipy qcserestipy self-requested a review May 10, 2026 17:31
@cotishq

cotishq commented May 12, 2026

Copy link
Copy Markdown
Contributor Author

@NucleoFusion @qcserestipy , would like your attention here, like i have to patch those codecov report or its normal to be there and also happy to make changes once you review this

@qcserestipy qcserestipy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@cotishq Thank you for your contribution! LGTM, and you can ignode the codecov failed pipelines for now

@bupd bupd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@bupd bupd changed the title fix(artifact): return errors from view command via RunE fix: Return errors from view command via RunE in artifact cmd May 26, 2026
@bupd bupd merged commit 8af2a92 into goharbor:main May 26, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: harbor artifact view returns exit code 0 on invalid input and API failures

3 participants