about summary refs log tree commit diff
path: root/tools/nixery/builder/cache.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/builder/cache.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/builder/cache.go')
-rw-r--r--tools/nixery/builder/cache.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/nixery/builder/cache.go b/tools/nixery/builder/cache.go
index a4ebe03e1c94..35b563e52496 100644
--- a/tools/nixery/builder/cache.go
+++ b/tools/nixery/builder/cache.go
@@ -152,7 +152,7 @@ func cacheManifest(ctx context.Context, s *State, key string, m json.RawMessage)
 	go s.Cache.localCacheManifest(key, m)
 
 	path := "manifests/" + key
-	_, size, err := s.Storage.Persist(ctx, path, func(w io.Writer) (string, int64, error) {
+	_, size, err := s.Storage.Persist(ctx, path, manifest.ManifestType, func(w io.Writer) (string, int64, error) {
 		size, err := io.Copy(w, bytes.NewReader([]byte(m)))
 		return "", size, err
 	})
@@ -220,7 +220,7 @@ func cacheLayer(ctx context.Context, s *State, key string, entry manifest.Entry)
 
 	j, _ := json.Marshal(&entry)
 	path := "builds/" + key
-	_, _, err := s.Storage.Persist(ctx, path, func(w io.Writer) (string, int64, error) {
+	_, _, err := s.Storage.Persist(ctx, path, "", func(w io.Writer) (string, int64, error) {
 		size, err := io.Copy(w, bytes.NewReader(j))
 		return "", size, err
 	})