mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-18 19:45:08 +02:00
Added --layout-path flag to save image in OCI layout.
Fixed #296. The output manifests may have `application/vnd.docker.distribution.manifest.v2+json` as their media types instead of `application/vnd.oci.image.manifest.v1+json`.
This commit is contained in:
@@ -34,6 +34,7 @@ import (
|
||||
"github.com/google/go-containerregistry/pkg/name"
|
||||
"github.com/google/go-containerregistry/pkg/v1"
|
||||
"github.com/google/go-containerregistry/pkg/v1/empty"
|
||||
"github.com/google/go-containerregistry/pkg/v1/layout"
|
||||
"github.com/google/go-containerregistry/pkg/v1/mutate"
|
||||
"github.com/google/go-containerregistry/pkg/v1/remote"
|
||||
"github.com/google/go-containerregistry/pkg/v1/tarball"
|
||||
@@ -101,6 +102,16 @@ func DoPush(image v1.Image, opts *config.KanikoOptions) error {
|
||||
}
|
||||
}
|
||||
|
||||
if opts.LayoutPath != "" {
|
||||
path, err := layout.Write(opts.LayoutPath, empty.Index)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "writing empty layout")
|
||||
}
|
||||
if err := path.AppendImage(image); err != nil {
|
||||
return errors.Wrap(err, "appending image")
|
||||
}
|
||||
}
|
||||
|
||||
destRefs := []name.Tag{}
|
||||
for _, destination := range opts.Destinations {
|
||||
destRef, err := name.NewTag(destination, name.WeakValidation)
|
||||
|
||||
Reference in New Issue
Block a user