Skip to content

Push to github container registry missing config annotations #1236

Description

@C-Loftus

Very well might be doing something wrong / misinterpreting the API, but when I push an OCI artifact to github container registry using this for the config descriptor

ConfigDescriptor: &ocispec.Descriptor{
			MediaType: "application/vnd.custom.config.v1+json",
			Annotations: map[string]string{
				"git-commit-hash": gitHash,
			},
		},

the media type shows up properly, but not the annotations. I expected to see an annotation for "git-commit-hash": gitHash.

"config": {
    "digest": "",
    "mediaType": "application/vnd.custom.config.v1+json",
    "size": 0
  }

The full PackManifest call is as follows. These are mainly dummy values for testing.

	desc, err := oras.PackManifest(ctx, repo, oras.PackManifestVersion1_1, "application/octet-stream", oras.PackManifestOptions{
		Layers: layers,
		ManifestAnnotations: map[string]string{
			"org.opencontainers.image.source": gitRemote,
		},
		ConfigDescriptor: &ocispec.Descriptor{
			MediaType: "application/vnd.custom.config.v1+json",
			Annotations: map[string]string{
				"sal.git-commit-hash": gitHash,
			},
		},
	})

I am using the following dependency and pushing to the standard github container registry (no special enterprise / self hosted registry)

oras.land/oras-go/v2 v2.6.1

From researching the docs it seemed like maybe Github container registry just wants all annotations in the block like this? These ManifestAnnotations definitely show up fine without issue

		ManifestAnnotations: map[string]string{
			"org.opencontainers.image.source": gitRemote,
		},

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions