mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-17 21:11:54 +02:00
Update go-containerregistry dep and remove unnecessary Options
This commit is contained in:
+2
-8
@@ -44,14 +44,8 @@ var GetImageLoader = func() (ImageLoader, error) {
|
||||
return cli, nil
|
||||
}
|
||||
|
||||
// WriteOptions are used to expose optional information to guide or
|
||||
// control the image write.
|
||||
type WriteOptions struct {
|
||||
// TODO(dlorenc): What kinds of knobs does the daemon expose?
|
||||
}
|
||||
|
||||
// Write saves the image into the daemon as the given tag.
|
||||
func Write(tag name.Tag, img v1.Image, wo WriteOptions) (string, error) {
|
||||
func Write(tag name.Tag, img v1.Image) (string, error) {
|
||||
cli, err := GetImageLoader()
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -59,7 +53,7 @@ func Write(tag name.Tag, img v1.Image, wo WriteOptions) (string, error) {
|
||||
|
||||
pr, pw := io.Pipe()
|
||||
go func() {
|
||||
pw.CloseWithError(tarball.Write(tag, img, &tarball.WriteOptions{}, pw))
|
||||
pw.CloseWithError(tarball.Write(tag, img, pw))
|
||||
}()
|
||||
|
||||
// write the image in docker save format first, then load it
|
||||
|
||||
+1
-5
@@ -21,11 +21,7 @@ import (
|
||||
"github.com/google/go-containerregistry/pkg/v1/empty"
|
||||
)
|
||||
|
||||
type RebaseOptions struct {
|
||||
// TODO(jasonhall): Rebase seam hint.
|
||||
}
|
||||
|
||||
func Rebase(orig, oldBase, newBase v1.Image, opts *RebaseOptions) (v1.Image, error) {
|
||||
func Rebase(orig, oldBase, newBase v1.Image) (v1.Image, error) {
|
||||
// Verify that oldBase's layers are present in orig, otherwise orig is
|
||||
// not based on oldBase at all.
|
||||
origLayers, err := orig.Layers()
|
||||
|
||||
+1
-8
@@ -25,15 +25,8 @@ import (
|
||||
"github.com/google/go-containerregistry/pkg/v1/remote/transport"
|
||||
)
|
||||
|
||||
// DeleteOptions are used to expose optional information to guide or
|
||||
// control the image deletion.
|
||||
type DeleteOptions struct {
|
||||
// TODO(mattmoor): Fail on not found?
|
||||
// TODO(mattmoor): Delete tag and manifest?
|
||||
}
|
||||
|
||||
// Delete removes the specified image reference from the remote registry.
|
||||
func Delete(ref name.Reference, auth authn.Authenticator, t http.RoundTripper, do DeleteOptions) error {
|
||||
func Delete(ref name.Reference, auth authn.Authenticator, t http.RoundTripper) error {
|
||||
scopes := []string{ref.Scope(transport.DeleteScope)}
|
||||
tr, err := transport.New(ref.Context().Registry, auth, t, scopes)
|
||||
if err != nil {
|
||||
|
||||
+1
-11
@@ -28,16 +28,8 @@ import (
|
||||
"github.com/google/go-containerregistry/pkg/v1/remote/transport"
|
||||
)
|
||||
|
||||
// WriteOptions are used to expose optional information to guide or
|
||||
// control the image write.
|
||||
type WriteOptions struct {
|
||||
// TODO(mattmoor): Expose "threads" to limit parallelism?
|
||||
}
|
||||
|
||||
// Write pushes the provided img to the specified image reference.
|
||||
func Write(ref name.Reference, img v1.Image, auth authn.Authenticator, t http.RoundTripper,
|
||||
wo WriteOptions) error {
|
||||
|
||||
func Write(ref name.Reference, img v1.Image, auth authn.Authenticator, t http.RoundTripper) error {
|
||||
ls, err := img.Layers()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -52,7 +44,6 @@ func Write(ref name.Reference, img v1.Image, auth authn.Authenticator, t http.Ro
|
||||
ref: ref,
|
||||
client: &http.Client{Transport: tr},
|
||||
img: img,
|
||||
options: wo,
|
||||
}
|
||||
|
||||
bs, err := img.BlobSet()
|
||||
@@ -92,7 +83,6 @@ type writer struct {
|
||||
ref name.Reference
|
||||
client *http.Client
|
||||
img v1.Image
|
||||
options WriteOptions
|
||||
}
|
||||
|
||||
// url returns a url.Url for the specified path in the context of this remote image reference.
|
||||
|
||||
+7
-13
@@ -26,39 +26,33 @@ import (
|
||||
"github.com/google/go-containerregistry/pkg/v1"
|
||||
)
|
||||
|
||||
// WriteOptions are used to expose optional information to guide or
|
||||
// control the image write.
|
||||
type WriteOptions struct {
|
||||
// TODO(mattmoor): Whether to store things compressed?
|
||||
}
|
||||
|
||||
// WriteToFile writes in the compressed format to a tarball, on disk.
|
||||
// This is just syntactic sugar wrapping tarball.Write with a new file.
|
||||
func WriteToFile(p string, tag name.Tag, img v1.Image, wo *WriteOptions) error {
|
||||
func WriteToFile(p string, tag name.Tag, img v1.Image) error {
|
||||
w, err := os.Create(p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer w.Close()
|
||||
|
||||
return Write(tag, img, wo, w)
|
||||
return Write(tag, img, w)
|
||||
}
|
||||
|
||||
// MultiWriteToFile writes in the compressed format to a tarball, on disk.
|
||||
// This is just syntactic sugar wrapping tarball.MultiWrite with a new file.
|
||||
func MultiWriteToFile(p string, tagToImage map[name.Tag]v1.Image, wo *WriteOptions) error {
|
||||
func MultiWriteToFile(p string, tagToImage map[name.Tag]v1.Image) error {
|
||||
w, err := os.Create(p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer w.Close()
|
||||
|
||||
return MultiWrite(tagToImage, wo, w)
|
||||
return MultiWrite(tagToImage, w)
|
||||
}
|
||||
|
||||
// Write is a wrapper to write a single image and tag to a tarball.
|
||||
func Write(tag name.Tag, img v1.Image, wo *WriteOptions, w io.Writer) error {
|
||||
return MultiWrite(map[name.Tag]v1.Image{tag: img}, wo, w)
|
||||
func Write(tag name.Tag, img v1.Image, w io.Writer) error {
|
||||
return MultiWrite(map[name.Tag]v1.Image{tag: img}, w)
|
||||
}
|
||||
|
||||
// MultiWrite writes the contents of each image to the provided reader, in the compressed format.
|
||||
@@ -66,7 +60,7 @@ func Write(tag name.Tag, img v1.Image, wo *WriteOptions, w io.Writer) error {
|
||||
// One manifest.json file at the top level containing information about several images.
|
||||
// One file for each layer, named after the layer's SHA.
|
||||
// One file for the config blob, named after its SHA.
|
||||
func MultiWrite(tagToImage map[name.Tag]v1.Image, wo *WriteOptions, w io.Writer) error {
|
||||
func MultiWrite(tagToImage map[name.Tag]v1.Image, w io.Writer) error {
|
||||
tf := tar.NewWriter(w)
|
||||
defer tf.Close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user