From 4a423145d30dafba2e2549b3914477f607a9739e Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Mon, 13 Feb 2023 07:13:57 -0500 Subject: [PATCH] spec-go/: scratch descriptor for config and layer to facilitate use by tools that import this reference code to identify this specific blob when working with an empty/scratch config blob and layer blob. This will utilize the same blob for both Signed-off-by: Vincent Batts --- specs-go/v1/manifest.go | 13 +++++++++++++ specs-go/v1/mediatype.go | 3 +++ 2 files changed, 16 insertions(+) diff --git a/specs-go/v1/manifest.go b/specs-go/v1/manifest.go index 730a09359..1c98820fd 100644 --- a/specs-go/v1/manifest.go +++ b/specs-go/v1/manifest.go @@ -36,3 +36,16 @@ type Manifest struct { // Annotations contains arbitrary metadata for the image manifest. Annotations map[string]string `json:"annotations,omitempty"` } + +// ScratchDigestSHA256 is the digest of a blob with content of `{}` (size of 2) +const ScratchDigestSHA256 = `sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a` + +// ScratchDescriptor is a SCRATCH descriptor for Manifest's `config` when that manifest does not have a config to provide. +func ScratchDescriptor() Descriptor { + return Descriptor{ + MediaType: MediaTypeImageScratch, + Digest: ScratchDigestSHA256, + Size: 2, + Data: []byte(`{}`), + } +} diff --git a/specs-go/v1/mediatype.go b/specs-go/v1/mediatype.go index bb331ad9d..a459915fa 100644 --- a/specs-go/v1/mediatype.go +++ b/specs-go/v1/mediatype.go @@ -70,6 +70,9 @@ const ( // MediaTypeImageConfig specifies the media type for the image configuration. MediaTypeImageConfig = "application/vnd.oci.image.config.v1+json" + // MediaTypeImageScratch specifies the media type for a SCRATCH blob. + MediaTypeImageScratch = "application/vnd.oci.example+json" + // MediaTypeArtifactManifest specifies the media type for a content descriptor. MediaTypeArtifactManifest = "application/vnd.oci.artifact.manifest.v1+json" )