Skip to content

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

@cotishq

Description

@cotishq

Description

harbor artifact view currently uses Run and logs errors internally instead of returning them to Cobra.
As a result, failure paths can still exit with code 0, which breaks scripting/CI expectations.

Steps to Reproduce

  1. Run:
    env XDG_CONFIG_HOME=/tmp/harbor-cli-verify/config \
       XDG_DATA_HOME=/tmp/harbor-cli-verify/data \
       ./bin/harbor-cli artifact view bad-format
    echo $?
  2. Observe the command fails logically, but exit code is 0.

Expected Behavior

When input parsing or API calls fail, the command should return a Cobra error and exit non-zero.

Actual Behavior

The command logs errors and returns from the Run closure, so process exit code can remain 0.

Environment

  • OS: Fedora Linux

Additional Context

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions