-
Hello, I have the following manifest:
I am trying to list all annotations for the manifest, but it does not work for some reason:
The problem is that ORAS returns me plain descriptor instead of full descriptor. It does not contain any data just digest, size and media type. Therefore, I will not get annotations:
Here is the repo: https://github.com/lzap/bootc-netboot/pkgs/container/bootc-netboot-example/184075903?tag=rhel-9.3.0-x86_64 In the documentation, I read that tag name (not digest) must be passed in in order to get full descriptor. But this is exactly what I am passing in. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @lzap , func main() {
ctx := context.Background()
reg := "ghcr.io"
repo, _ := remote.NewRepository(reg + "/lzap/bootc-netboot-example")
repo.Client = &auth.Client{
Client: retry.DefaultClient,
Cache: auth.NewCache(),
}
tag := "rhel-9.3.0-x86_64"
_, manifestBytes, err := oras.FetchBytes(ctx, repo, tag, oras.FetchBytesOptions{})
if err != nil {
panic(err)
}
var manifest struct {
Annotations map[string]string `json:"annotations"`
}
if err := json.Unmarshal(manifestBytes, &manifest); err != nil {
panic(err)
}
fmt.Println(manifest.Annotations)
} Using
As of |
Beta Was this translation helpful? Give feedback.
Hi @lzap ,
Repository.Resolve
is to get the plain descriptor of the tag and is not able to get the annotations.In order to get the annotations of a manifest, you would need to fetch the manifest content (equivalent to
oras manifest fetch
) and manually parse it. Something like: