-
Notifications
You must be signed in to change notification settings - Fork 208
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
The err from manifests.Resolve(ctx, ref) is not well handled and causes oras print out incorrect output.
oras/cmd/oras/manifest/push.go
Lines 131 to 149 in 5e2750d
| got, err := manifests.Resolve(ctx, ref) | |
| // push the manifest if the reference does not exist; | |
| // if the reference exists, then push the manifest if digests mismatch | |
| if errors.Is(err, errdef.ErrNotFound) || (err == nil && got.Digest != desc.Digest) { | |
| if err = display.PrintStatus(desc, "Uploading", verbose); err != nil { | |
| return err | |
| } | |
| if err = manifests.PushReference(ctx, desc, bytes.NewReader(contentBytes), ref); err != nil { | |
| return err | |
| } | |
| if err = display.PrintStatus(desc, "Uploaded ", verbose); err != nil { | |
| return err | |
| } | |
| } else { | |
| if err := display.PrintStatus(desc, "Exists", verbose); err != nil { | |
| return err | |
| } | |
| } |
Sample output:
$ oras manifest push ${name} manifest.json --debug
DEBU[0000] Request URL: "https://host.docker.internal:5000/v2/hello/manifests/sha256:361358b5c6b151255f3ade1d0dc0bfc64d0ec1455c55c9c86cbfc027b4981308"
DEBU[0000] Request method: "HEAD"
DEBU[0000] Request headers:
DEBU[0000] "Accept": "application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, application/vnd.cncf.oras.artifact.manifest.v1+json"
DEBU[0000] "User-Agent": "oras/0.15.0"
ERRO[0000] Error in getting response: %!w(tls.RecordHeaderError={first record does not look like a TLS handshake [72 84 84 80 47] 0xc000286000})
Pushed host.docker.internal:5000/hello
Digest: sha256:361358b5c6b151255f3ade1d0dc0bfc64d0ec1455c55c9c86cbfc027b4981308Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working