Skip to content

Commit

Permalink
spec-go/: scratch descriptor for config and layer
Browse files Browse the repository at this point in the history
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 <vbatts@hashbangbash.com>
  • Loading branch information
vbatts committed Feb 24, 2023
1 parent dc4a8ee commit 303ac3d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions specs-go/v1/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(`{}`),
}
}
3 changes: 3 additions & 0 deletions specs-go/v1/mediatype.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

0 comments on commit 303ac3d

Please sign in to comment.