Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 15 commits into from
Apr 19, 2023

Conversation

joshspicer
Copy link
Member

@joshspicer joshspicer commented Apr 13, 2023

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 Surface docker-content-digest oj pull, utilize manifest annotations per Feature/Template, and info command clean up 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 Surface docker-content-digest on manifest pulls, 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
Copy link
Contributor

@chrmarti chrmarti left a comment

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.

src/spec-configuration/containerCollectionsOCI.ts Outdated Show resolved Hide resolved
src/spec-configuration/containerCollectionsOCI.ts Outdated Show resolved Hide resolved
src/spec-configuration/containerTemplatesOCI.ts Outdated Show resolved Hide resolved
chrmarti
chrmarti previously approved these changes Apr 19, 2023
Copy link
Contributor

@chrmarti chrmarti left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@chrmarti chrmarti force-pushed the joshspicer/annotations-and-content-digest branch from bc0f8c7 to 4d8755d Compare April 19, 2023 09:36
chrmarti
chrmarti previously approved these changes Apr 19, 2023
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants