Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When subject artifact reference is not specified, error output of oras attach is confusing #1404

Closed
1 task
qweeah opened this issue Jun 13, 2024 · 2 comments
Closed
1 task
Assignees
Labels
ux User experience related
Milestone

Comments

@qweeah
Copy link
Contributor

qweeah commented Jun 13, 2024

What happened in your environment?

Running below command with empty variable $BASE_IMAGE (and thus actually not specified):

> oras attach --artifact-type "application/vnd.openvex.vex+json" $BASE_IMAGE ./vex/python3.12.2.vex.json
Error: neither file nor annotation provided in the command
Usage: oras attach [flags] --artifact-type=<type> <name>{:<tag>|@<digest>} <file>[:<layer_media_type>] [...]
To attach to an existing artifact, please provide files via argument or annotations via flag "--annotation". Run "oras attach -h" for more options and examples

The error message still "makes me think" because I specified a file and I don't want to add annotations.

What did you expect to happen?

The output error message should tell that the problem is with the image (or subject artifact).

How can we reproduce it?

Run oras attach without specifying any subject artifact reference.

What is the version of your ORAS CLI?

Version: 1.2.0
Go version: go1.22.3
Git commit: dcef719
Git tree state: clean

What is your OS environment?

20.04

Are you willing to submit PRs to fix it?

  • Yes, I am willing to fix it.
@qweeah qweeah added bug Something isn't working triage New issues or PRs to be acknowledged by maintainers ux User experience related and removed bug Something isn't working labels Jun 13, 2024
@qweeah
Copy link
Contributor Author

qweeah commented Jun 13, 2024

Technically, a valid artifact reference can also be a valid file path. When a user only provides one argument, it's hard to which of the below usages matches the real case:

  • The subject reference is missing
  • The to-be-attach file path is missing

Current(v1.2.0) error message handles the latter but the real use case is the former.

@qweeah
Copy link
Contributor Author

qweeah commented Jun 13, 2024

IMHO, it's better to follow the practice suggested by CLI Guideline and make file reference specified by flags. E.g. The usage of oras attach should changed to

oras attach --artifact-type "application/vnd.openvex.vex+json" $BASE_IMAGE --file ./vex/python3.12.2.vex.json

Since it's breaking change, specifying file paths via argument should still be allowed but trigger deprecation warning.

@qweeah qweeah changed the title confusing error in error output of oras attach when subject artifact reference is not specified When subject artifact reference is not specified, error output of oras attach is confusing Jun 13, 2024
@qweeah qweeah removed the triage New issues or PRs to be acknowledged by maintainers label Jun 28, 2024
@qweeah qweeah added this to the v1.3.0 milestone Jun 28, 2024
@qweeah qweeah self-assigned this Jun 28, 2024
@qweeah qweeah closed this as completed Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ux User experience related
Projects
None yet
Development

No branches or pull requests

1 participant