瀏覽代碼

push empty descriptor layer when using OCI version 1.1 for Compose artifact
it fixes a repository creation issue when pushing the 1st time a Compose OCI artifact on the Hub

Signed-off-by: Guillaume Lours <[email protected]>

Guillaume Lours 11 月之前
父節點
當前提交
3f5898f8d0
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      internal/ocipush/push.go

+ 4 - 0
internal/ocipush/push.go

@@ -88,6 +88,10 @@ func PushManifest(
 	layers []Pushable,
 	ociVersion api.OCIVersion,
 ) error {
+	// Check if we need an extra empty layer for the manifest config
+	if ociVersion == api.OCIVersion1_1 || ociVersion == "" {
+		layers = append(layers, Pushable{Descriptor: v1.DescriptorEmptyJSON, Data: []byte("{}")})
+	}
 	// prepare to push the manifest by pushing the layers
 	layerDescriptors := make([]v1.Descriptor, len(layers))
 	for i := range layers {