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

Improve notation plugin error message #867

Closed
FeynmanZhou opened this issue Jan 15, 2024 · 5 comments · Fixed by #870
Closed

Improve notation plugin error message #867

FeynmanZhou opened this issue Jan 15, 2024 · 5 comments · Fixed by #870
Assignees
Labels
bug Something isn't working
Milestone

Comments

@FeynmanZhou
Copy link
Member

What is not working as expected?

This issue summarizes the error messages of notation plugin that I suggest improving in v1.1.x.

Negative case: install a plugin on a non-matching CPU architecture machine

I installed Notation AKV plugin (Linux_arm64 version) on an Linux_amd64 machine with Notation v1.1.0 (main branch). The error response is empty in stderr as follows. This empty error response also exists when I installed the AWS Signer plugin in a mismatched Arch.

$ notation plugin install --file notation-azure-kv_1.0.1_linux_arm64.tar.gz
···
Error: plugin installation failed: failed to get metadata of new plugin: ERROR: response is not in JSON format. error: fork/exec /tmp/notation-plugin1835003109/notation-azure-kv: exec format error, stderr:

What did you expect to happen?

Suggested change:

By following the Notation error message guidance, notation should prompt users that the architecture of the installing plugin is not matched with the machine:

$ notation plugin install --file notation-azure-kv_1.0.1_linux_arm64.tar.gz
···
Error: plugin installation failed: failed to get metadata of new plugin. exec format error, stderr: non-matching CPU architecture
Use a matched architecture of the plugin and try to install it again

Or even give a much intelligent prompt with a solution:

$ notation plugin install --file notation-azure-kv_1.0.1_linux_arm64.tar.gz
···
Error: plugin installation failed: failed to get metadata of new plugin. exec format error, non-matching CPU architecture
Use a matched architecture linux/amd64 of the plugin and try to install it again

How can we reproduce it?

See above

Describe your environment

Linux, Golang 21.06

What is the version of your notation-go Library?

v1.1.0

@FeynmanZhou FeynmanZhou added bug Something isn't working triage Need to triage labels Jan 15, 2024
@JeyJeyGao
Copy link
Contributor

JeyJeyGao commented Jan 15, 2024

If you use a text file as the plugin executable, the OS will return the same error message. Therefore, we may not be able to determine the detailed error of fork/exec, whether it is an OS architecture issue or not.

How about error message for notation-go:

plugin installation failed: failed to execute the get-plugin-metadata command for azure-kv plugin: fork/exec /tmp/notation-plugin28956171/notation-azure-kv: exec format error

And add the suggestion in the CLI side:

Error: plugin installation failed: failed to execute the get-plugin-metadata command for azure-kv plugin: fork/exec /tmp/notation-plugin28956171/notation-azure-kv: exec format error.
Please ensure the plugin is executable on the current OS and compliant with the Notation plugin protocol. If the error persists, try reaching out to the plugin maintainers for help.

@FeynmanZhou
Copy link
Member Author

FeynmanZhou commented Jan 15, 2024

It seems not feasible to detect the OS/Arch information of the plugin during installation. Therefore, notation can only output generic error message regardless of in which error case under the current implementation. This is not helpful to notation CLI users.

Is it possible to enable notation detect the OS/Arch information of the plugin during installation in future releases? In this way, we can generate much more actionable suggestions in the error message to users.

@FeynmanZhou
Copy link
Member Author

FeynmanZhou commented Jan 15, 2024

@JeyJeyGao

My suggested change for the error message from the notation CLI:

Error: plugin installation failed: failed to execute the get-plugin-metadata command for azure-kv plugin: fork/exec /tmp/notation-plugin28956171/notation-azure-kv: exec format error.
Please ensure the plugin is executable on the current OS and compliant with the plugin installation requirements. If the error persists, try reaching out to the plugin maintainers for help.

Note that there is no concept "Notation plugin protocol" existed in Notary Project or plugin vendors. In general, plugin vendors and Notary Project maintainers publish the plugin installation requirements on the website. So the most straightforward way here is to remind users to re-check and follow the plugin installation requirements accordingly.

@JeyJeyGao
Copy link
Contributor

JeyJeyGao commented Jan 15, 2024

Error: plugin installation failed: failed to execute the get-plugin-metadata command for azure-kv plugin: fork/exec /tmp/notation-plugin28956171/notation-azure-kv: exec format error.
Please ensure the plugin is executable and meet the installation requirements on the <OS/Arch>. If the error persists, try reaching out to the plugin maintainers for help.

How about this error message for Notation CLI? We can provide the OS and Arch in the recommandation.

@FeynmanZhou
Copy link
Member Author

The prompted recommendation in notation CLI sounds good to me.

@yizha1 yizha1 removed the triage Need to triage label Jan 16, 2024
@yizha1 yizha1 transferred this issue from notaryproject/notation-go Jan 16, 2024
@yizha1 yizha1 added this to the 1.1.0 milestone Jan 16, 2024
@yizha1 yizha1 moved this from Todo to In Progress in Notary Project Planning Board Jan 16, 2024
JeyJeyGao added a commit to notaryproject/notation-go that referenced this issue Jan 18, 2024
- added `PluginUnknownError`, `PluginValidityError`,
`PluginDirectoryError`. For each error types, Notation CLI should
provide a recommanded suggestion to solve them.
- improved error message

Resolve part of: notaryproject/notation#824
Resolve part of: notaryproject/notation#867

Signed-off-by: Junjie Gao <[email protected]>

---------

Signed-off-by: Junjie Gao <[email protected]>
@github-project-automation github-project-automation bot moved this from In Progress to Done in Notary Project Planning Board Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants