oras-go: Missing manifest annotations.
I don’t know if I’m doing anything wrong, but I’ve used oras.WithManifestAnnotations()
to push my artefact with some metadata, that worked well because if I curl the repo directly I see it there:
$ curl -sL -u"user:pass" https://my-repo/v2/oso-plugins/manifests/oso-legacy | jq .
{
"schemaVersion": 2,
"config": {
"mediaType": "application/vnd.unknown.config.v1+json",
"digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
"size": 2
},
"layers": [
{
"mediaType": "application/vnd.oci.image.layer.v1.tar",
"digest": "sha256:8e985dc2c81bd5e8bfafb2858b9a9cb420c02a29d5a96f32eb00f5850556410a",
"size": 755,
"annotations": {
"hook": "chmod +x ~/.oso/bin/oso-legacy",
"org.opencontainers.image.title": "oso-legacy"
}
}
],
"annotations": {
"caveats": "to get auto-completions do this...",
"description": "a bridge to the past",
"shortDescription": "a plugin"
}
}
But then when I pull it using desc, artefacts, err := oras.Pull(...)
I can loop through the artefacts and get the annotations from each of them, but desc.Annotations
is empty…
The result of fmt.Println(desc.Annotations)
is:
Annotations: map[]
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 30 (30 by maintainers)
@luisdavim I’m closing this issue as this issue is in an inactive state for a long time. Meanwhile,
oras-go
has evolved intov2
and maybe you can try again with v2 APIs.Additionally, I think there is a concept misunderstanding. The
annotations
field of the manifest descriptor is not the same as theannotations
field of the manifest itself. Theannotations
field of the manifest will not and should not be populated to theannotations
field of the manifest descriptor by default. Therefore, fetching the raw JSON of the manifest and extracting theannotations
field is not a workaround but the right way to do so.OK, so half the issue is solved with that. Let’s get that merged in and then solve the other.
Hang tight, got a PR coming to test
Thanks for the reply, I don’t have anything public, but I let me see what I can do.
That isn’t necessarily wrong, but storing annotations on individual descriptors of any kind is valid according to the spec, so you should be able to there as well, and retrieve it.
Understood. I commented there; let’s see if the proposed direction works.
I find that odd. I am going to dig a little deeper. It just does
from.Resolve
to get the originaldesc
.