Skip to content

feat: AppendImage/Index with optional name.Reference #87

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

Merged
merged 5 commits into from
Oct 1, 2024

Conversation

dtrudg
Copy link
Member

@dtrudg dtrudg commented Sep 27, 2024

Adds f.AppendImage and f.AppendIndex, which append a v1.Image or a v1.ImageIndex to the SIF, respectively.

The OptAppendReference functional option can be used to provide a name.Reference that will be stored as an annotation against the new descriptor in the RootIndex, with the key org.opencontainers.image.ref.name, as is convention for associating references with items stored in an OCI layout.

Fixes #83
Fixes #81

Note reference set in golden files:

$ singularity sif dump 7  pkg/sif/testdata/TestAppendImage/WithReference.golden | jq
{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.index.v1+json",
  "manifests": [
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "size": 525,
      "digest": "sha256:432f982638b3aefab73cc58ab28f5c16e96fdb504e8c134fc58dff4bae8bf338",
      "platform": {
        "architecture": "arm64",
        "os": "linux",
        "variant": "v8"
      }
    },
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "size": 423,
      "digest": "sha256:e4ccb8ccf3c6e47f195a31b13bcf7f3a0075d06dabe450d373f2720f72bab898",
      "annotations": {
        "org.opencontainers.image.ref.name": "myimage:v1"
      }
    }
  ]
}

$ singularity sif dump 8  pkg/sif/testdata/TestAppendIndex/WithReference.golden | jq
{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.index.v1+json",
  "manifests": [
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "size": 525,
      "digest": "sha256:432f982638b3aefab73cc58ab28f5c16e96fdb504e8c134fc58dff4bae8bf338",
      "platform": {
        "architecture": "arm64",
        "os": "linux",
        "variant": "v8"
      }
    },
    {
      "mediaType": "application/vnd.oci.image.index.v1+json",
      "size": 250,
      "digest": "sha256:530cfe4c47e21838156cb43fe8e3be6fefcc3c2d8e7f4f575d7075a9b29b2343",
      "annotations": {
        "org.opencontainers.image.ref.name": "myindex:v1"
      }
    }
  ]
}

@dtrudg dtrudg self-assigned this Sep 27, 2024
@dtrudg dtrudg force-pushed the append-methods branch 4 times, most recently from 99dd119 to 763ab58 Compare September 27, 2024 15:02
Adds `f.AppendImage` and `f.AppendIndex`, which append a `v1.Image` or a
`v1.ImageIndex` to the SIF, respectively.

The `OptAppendReference` functional option can be used to provide a
`name.Reference` that will be stored as an annotation against the new
descriptor in the RootIndex, with the key
`org.opencontainers.image.ref.name`, as is convention for associating
references with items stored in an OCI layout.

Fixes sylabs#83
Fixes sylabs#81
@dtrudg dtrudg marked this pull request as ready for review September 27, 2024 15:28
@dtrudg dtrudg requested a review from tri-adam September 27, 2024 15:28
Copy link
Member

@tri-adam tri-adam left a comment

Choose a reason for hiding this comment

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

A few comments/questions on this one. Thanks!

@dtrudg dtrudg merged commit 166c3c1 into sylabs:main Oct 1, 2024
10 checks passed
@dtrudg dtrudg deleted the append-methods branch October 1, 2024 14:26
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.

AppendImage/Index Store Image / ImageIndex with name / tag annotation
2 participants