Skip to content

fix(artifact): return errors from view command via RunE#912

Open
cotishq wants to merge 1 commit into
goharbor:mainfrom
cotishq:fix/artifact-view-rune-error-exit
Open

fix(artifact): return errors from view command via RunE#912
cotishq wants to merge 1 commit into
goharbor:mainfrom
cotishq:fix/artifact-view-rune-error-exit

Conversation

@cotishq
Copy link
Copy Markdown
Contributor

@cotishq cotishq commented May 10, 2026

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
Copy link
Copy Markdown

codecov Bot commented May 10, 2026

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
Copy link
Copy Markdown
Contributor Author

cotishq commented May 12, 2026

@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

Copy link
Copy Markdown
Collaborator

@qcserestipy qcserestipy left a comment

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

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

2 participants