Skip to content

Surface docker-content-digest on manifest pulls, manifest annotations per Feature/Template, and info command clean up - #490

Merged
joshspicer merged 15 commits into
mainfrom
joshspicer/annotations-and-content-digest
Apr 19, 2023
Merged

joshspicer merged 15 commits into
mainfrom
joshspicer/annotations-and-content-digest

Conversation

@joshspicer

@joshspicer joshspicer commented Apr 13, 2023 •

Copy link
Copy Markdown
Contributor

This patch introduces two small additions to the registry/OCI implementation. Both additions are generally useful to have, and have been extracted from my experimental implementation of 'Feature Dependencies' with a dependsOn attribute. This patch, however, does not depend on any dependency-related spec and can be included regardless.

Ref: https://github.com/github/codespaces/issues/11243, devcontainers/spec#109

Changes:

  • When fetching a manifest, also read the docker-content-digest header and pass that along to the caller. This will be useful:

  • The open containers image spec includes a map of arbitrary annotations. Supporting the ability to attach annotations to an individual Feature/Template at publish time is a generally useful mechanism to have.

    • One example where this could be used is attaching pointers to Features that a given Feature depends on. This allows the CLI to not need to download and extract an entire Feature archive to get to this metadata.

Possible Example (dev.containers.experimental.dependsOn) :

{
    "contentDigest": "sha256:b4153e1557157ebb610ca86353fa62602a759110a6a3bc6730599c86d75fd0cc",
    "manifestObj": {
        "schemaVersion": 2,
        "mediaType": "application/vnd.oci.image.manifest.v1+json",
        "config": {
            "mediaType": "application/vnd.devcontainers",
            "digest": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
            "size": 0
        },
        "layers": [
            {
                "mediaType": "application/vnd.devcontainers.layer.v1+tar",
                "digest": "sha256:204ab620e4f4ad0e9db79de73d8941b0de849ec3cc5dbacae693e87eeaca8d88",
                "size": 3584,
                "annotations": {
                    "org.opencontainers.image.title": "devcontainer-feature-C.tgz"
                }
            }
        ],
        "annotations": {
            "dev.containers.experimental.dependsOn": "{\"ghcr.io/joshspicer/dependsOnExperiment/A\":{\"magicNumber\":\"40\"},\"ghcr.io/joshspicer/dependsOnExperiment/E\":{\"magicNumber\":\"50\"}}",
            "com.github.package.type": "devcontainer_feature"
        }
    }
  • This patch also refactors the info command to consolidate code and allows for a 'verbose' mode that dumps all the info this command can query.

image

image

@joshspicer joshspicer changed the title OCI Registry Implementation additions Apr 13, 2023
@joshspicer joshspicer changed the title Surface docker-content-digest oj pull, utilize manifest annotations per Feature/Template, and info command clean up Apr 13, 2023
@joshspicer
joshspicer marked this pull request as ready for review April 13, 2023 16:09
@joshspicer
joshspicer requested a review from a team as a code owner April 13, 2023 16:09
@joshspicer joshspicer self-assigned this Apr 13, 2023

@chrmarti Christof Marti (chrmarti) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, a few comments.

@chrmarti Christof Marti (chrmarti) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@joshspicer
joshspicer merged commit 3d0a3ff into main Apr 19, 2023
@joshspicer
joshspicer deleted the joshspicer/annotations-and-content-digest branch April 19, 2023 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants