Skip to content

Annotations not loading #1276

Answered by Wwwsylvia
lzap asked this question in Q&A
Discussion options

You must be logged in to vote

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:

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]st…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lzap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants