about summary refs log tree commit diff
path: root/tools/nixery/manifest/manifest.go
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-10-29T15·13+0100
committerVincent Ambo <mail@tazj.in>2020-10-29T16·07+0100
commitcc35bf0fc3a900dccf4f9edcc581cadb5956c439 (patch)
treeec23fc45ff5c0194e2bbb902d95f18c634c14c2b /tools/nixery/manifest/manifest.go
parent8a5c446babbac860d6eaee6f7e0c5a5a8a6f4183 (diff)
feat(storage): Add support for content-types (GCS only)
Extends storage.Persist to accept a Content-Type argument, which in
the GCS backend is persisted with the object to ensure that the object
is served back with this content-type.

This is not yet implemented for the filesystem backend, where the
parameter is simply ignored.

This should help in the case of clients which expect the returned
objects to have content-types set when, for example, fetching layers
by digest.
Diffstat (limited to 'tools/nixery/manifest/manifest.go')
-rw-r--r--tools/nixery/manifest/manifest.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/nixery/manifest/manifest.go b/tools/nixery/manifest/manifest.go
index 0d36826fb7e5..e499920075f0 100644
--- a/tools/nixery/manifest/manifest.go
+++ b/tools/nixery/manifest/manifest.go
@@ -28,8 +28,8 @@ const (
 	schemaVersion = 2
 
 	// media types
-	manifestType = "application/vnd.docker.distribution.manifest.v2+json"
-	layerType    = "application/vnd.docker.image.rootfs.diff.tar.gzip"
+	ManifestType = "application/vnd.docker.distribution.manifest.v2+json"
+	LayerType    = "application/vnd.docker.image.rootfs.diff.tar.gzip"
 	configType   = "application/vnd.docker.container.image.v1+json"
 
 	// image config constants
@@ -117,7 +117,7 @@ func Manifest(arch string, layers []Entry) (json.RawMessage, ConfigLayer) {
 	hashes := make([]string, len(layers))
 	for i, l := range layers {
 		hashes[i] = l.TarHash
-		l.MediaType = layerType
+		l.MediaType = LayerType
 		l.TarHash = ""
 		layers[i] = l
 	}
@@ -126,7 +126,7 @@ func Manifest(arch string, layers []Entry) (json.RawMessage, ConfigLayer) {
 
 	m := manifest{
 		SchemaVersion: schemaVersion,
-		MediaType:     manifestType,
+		MediaType:     ManifestType,
 		Config: Entry{
 			MediaType: configType,
 			Size:      int64(len(c.Config)),