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

chore: add reference details to registry errors #1152

Merged
merged 2 commits into from
Oct 26, 2023

Conversation

sajayantony
Copy link
Contributor

What this PR does / why we need it:
The errors from the oras CLI does not show the actual value that was provided.
The following PR updates the erros to include the actual user provided reference here -

$ oras copy test someotherregistry.azurecr.ui/myimage:v1
Error: "test": invalid reference: missing registry or repository

$ oras copy test.com someotherregistry.azurecr.ui/myimage:v1
Error: "test.com": invalid reference: missing registry or repository

$ oras copy test.com/test someotherregistry.azurecr.ui/myimage:v1
Error: "test.com/test": no tag or digest when expecting <name:tag|name@digest>

$ oras copy test.com/test: someotherregistry.azurecr.ui/myimage:v1
Error: "test.com/test:": no tag or digest when expecting <name:tag|name@digest>

$ oras copy test.com/test@ someotherregistry.azurecr.ui/myimage:v1
Error: "test.com/test@": no tag or digest when expecting <name:tag|name@digest>

$ oras copy test.com/test:() someotherregistry.azurecr.ui/myimage:v1
Error: "test.com/test:()": invalid reference: invalid tag "()"

$ oras copy test.com/test@invalid someotherregistry.azurecr.ui/myimage:v1
Error: "test.com/test@invalid": invalid reference: invalid digest "invalid": invalid checksum digest format

shizhMSFT pushed a commit to oras-project/oras-go that referenced this pull request Oct 26, 2023
Include values of the artifact and or related context in the errors - 

This is related to oras-project/oras#1152. See
the oras-project/oras#1152 to see the updates to output of errors.

Signed-off-by: Sajay Antony <sajaya@microsoft.com>
@shizhMSFT shizhMSFT changed the title Add reference details to registry errors chore: add reference details to registry errors Oct 26, 2023
sajayantony and others added 2 commits October 26, 2023 17:08
Signed-off-by: Sajay Antony <sajaya@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
@codecov-commenter
Copy link

Codecov Report

Merging #1152 (1a689ea) into main (f2ed16a) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##             main    #1152      +/-   ##
==========================================
- Coverage   79.47%   79.45%   -0.02%     
==========================================
  Files          65       65              
  Lines        3493     3495       +2     
==========================================
+ Hits         2776     2777       +1     
- Misses        506      507       +1     
  Partials      211      211              
Files Coverage Δ
cmd/oras/internal/errors/errors.go 100.00% <100.00%> (ø)
cmd/oras/internal/option/remote.go 78.09% <100.00%> (-0.28%) ⬇️
cmd/oras/internal/option/target.go 84.69% <100.00%> (ø)
cmd/oras/root/manifest/delete.go 83.54% <100.00%> (ø)

Copy link
Contributor

@qweeah qweeah left a comment

Choose a reason for hiding this comment

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

lgtm

@qweeah qweeah merged commit 264df60 into oras-project:main Oct 26, 2023
6 checks passed
@sajayantony
Copy link
Contributor Author

Thanks @shizhMSFT @qweeah

@vsoch
Copy link
Contributor

vsoch commented Oct 29, 2023

Any possibility to get a develop or branch named container build here? I just ran into the (previous) ambiguous error and this would be very helpful!

In the meantime I'll do a custom build, but would be great to have this tag ready to go.

@qweeah
Copy link
Contributor

qweeah commented Oct 30, 2023

@vsoch You may try go install oras.land/oras/cmd/oras@main if you have g1.21.x installed.

@vsoch
Copy link
Contributor

vsoch commented Oct 30, 2023

@qweeah it's for an operator sidecar that (ideally) doesn't require minimal setup. I am suggesting building a latest tag (that reflects the current main branch) so users always have access to the latest (and not the last release, which can be months old).

@qweeah
Copy link
Contributor

qweeah commented Oct 30, 2023

Agree, adding a container can be a good start. The container can be built when merging PR into main branch Not sure about the tag naming, maybe main is better than latest? @FeynmanZhou

@vsoch
Copy link
Contributor

vsoch commented Oct 30, 2023

Perhaps a develop or main (branch) tag would make sense? It should indicate “this is not a production container there might be bugs use at your own risk!”

@sajayantony
Copy link
Contributor Author

@qweeah is there an issue for pushing an updated container on merge or maybe daily?

@qweeah
Copy link
Contributor

qweeah commented Oct 30, 2023

@qweeah is there an issue for pushing an updated container on merge or maybe daily?

I will create one.

@FeynmanZhou
Copy link
Member

FeynmanZhou commented Oct 31, 2023

Any possibility to get a develop or branch named container build here? I just ran into the (previous) ambiguous error and this would be very helpful!

In the meantime I'll do a custom build, but would be great to have this tag ready to go.

@vsoch Are you expecting an ORAS image with a latest flag automatically built from the main branch for non-prod environment? Is this issue #1155 meet your expectation?

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.

6 participants