From 3c63ff776ed7d480d7d7b9af2a930229a60916f9 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Tue, 5 Mar 2019 16:41:01 -0800 Subject: [PATCH] testing --- .../Dockerfile_test_copy_same_file_many_times | 46 +++++++++---------- integration/images.go | 1 + integration/integration_test.go | 44 ++++++++++-------- .../pkg/v1/remote/write.go | 20 ++++++++ 4 files changed, 68 insertions(+), 43 deletions(-) diff --git a/integration/dockerfiles/Dockerfile_test_copy_same_file_many_times b/integration/dockerfiles/Dockerfile_test_copy_same_file_many_times index 6acea2a4b5..bd4308ea80 100644 --- a/integration/dockerfiles/Dockerfile_test_copy_same_file_many_times +++ b/integration/dockerfiles/Dockerfile_test_copy_same_file_many_times @@ -24,26 +24,26 @@ COPY context/foo /foo COPY context/foo /foo COPY context/foo /foo COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo -COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo +# COPY context/foo /foo diff --git a/integration/images.go b/integration/images.go index 27d54501cb..0c278ca79c 100644 --- a/integration/images.go +++ b/integration/images.go @@ -219,6 +219,7 @@ func (d *DockerFileBuilder) BuildImage(imageRepo, gcsBucket, dockerfilesPath, do ) timer = timing.Start(dockerfile + "_kaniko") + fmt.Println(kanikoCmd) out, err = RunCommandWithoutTest(kanikoCmd) timing.DefaultRun.Stop(timer) if err != nil { diff --git a/integration/integration_test.go b/integration/integration_test.go index 69aa777882..498a8483f2 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -150,26 +150,26 @@ func TestMain(m *testing.M) { name: "Building kaniko image", command: []string{"docker", "build", "-t", ExecutorImage, "-f", "../deploy/Dockerfile", ".."}, }, - { - name: "Building cache warmer image", - command: []string{"docker", "build", "-t", WarmerImage, "-f", "../deploy/Dockerfile_warmer", ".."}, - }, - { - name: "Building onbuild base image", - command: []string{"docker", "build", "-t", config.onbuildBaseImage, "-f", "dockerfiles/Dockerfile_onbuild_base", "."}, - }, - { - name: "Pushing onbuild base image", - command: []string{"docker", "push", config.onbuildBaseImage}, - }, - { - name: "Building hardlink base image", - command: []string{"docker", "build", "-t", config.hardlinkBaseImage, "-f", "dockerfiles/Dockerfile_hardlink_base", "."}, - }, - { - name: "Pushing hardlink base image", - command: []string{"docker", "push", config.hardlinkBaseImage}, - }, + // { + // name: "Building cache warmer image", + // command: []string{"docker", "build", "-t", WarmerImage, "-f", "../deploy/Dockerfile_warmer", ".."}, + // }, + // { + // name: "Building onbuild base image", + // command: []string{"docker", "build", "-t", config.onbuildBaseImage, "-f", "dockerfiles/Dockerfile_onbuild_base", "."}, + // }, + // { + // name: "Pushing onbuild base image", + // command: []string{"docker", "push", config.onbuildBaseImage}, + // }, + // { + // name: "Building hardlink base image", + // command: []string{"docker", "build", "-t", config.hardlinkBaseImage, "-f", "dockerfiles/Dockerfile_hardlink_base", "."}, + // }, + // { + // name: "Pushing hardlink base image", + // command: []string{"docker", "push", config.hardlinkBaseImage}, + // }, } for _, setupCmd := range setupCommands { @@ -192,6 +192,10 @@ func TestMain(m *testing.M) { g := errgroup.Group{} for dockerfile := range imageBuilder.FilesBuilt { df := dockerfile + if df != "Dockerfile_test_copy_same_file_many_times" { + fmt.Println("skipping", df) + continue + } g.Go(func() error { return imageBuilder.BuildImage(config.imageRepo, config.gcsBucket, dockerfilesPath, df) }) diff --git a/vendor/github.com/google/go-containerregistry/pkg/v1/remote/write.go b/vendor/github.com/google/go-containerregistry/pkg/v1/remote/write.go index 0f6b0f68fa..6a40f79380 100644 --- a/vendor/github.com/google/go-containerregistry/pkg/v1/remote/write.go +++ b/vendor/github.com/google/go-containerregistry/pkg/v1/remote/write.go @@ -41,14 +41,18 @@ type manifest interface { // Write pushes the provided img to the specified image reference. func Write(ref name.Reference, img v1.Image, auth authn.Authenticator, t http.RoundTripper) error { + fmt.Println("writing image now") ls, err := img.Layers() if err != nil { + fmt.Println("Error with layers") return err } scopes := scopesForUploadingImage(ref, ls) tr, err := transport.New(ref.Context().Registry, auth, t, scopes) if err != nil { + fmt.Println("Error with transport") + return err } w := writer{ @@ -61,6 +65,7 @@ func Write(ref name.Reference, img v1.Image, auth authn.Authenticator, t http.Ro for _, l := range ls { l := l g.Go(func() error { + fmt.Println("uploading one initial") return w.uploadOne(l) }) } @@ -69,15 +74,18 @@ func Write(ref name.Reference, img v1.Image, auth authn.Authenticator, t http.Ro // We can't read the ConfigLayer, because of streaming layers, since the // config hasn't been calculated yet. if err := g.Wait(); err != nil { + fmt.Println("Error with waiting") return err } // Now that all the layers are uploaded, upload the config file blob. l, err := partial.ConfigLayer(img) if err != nil { + fmt.Println("Error with config layer") return err } if err := w.uploadOne(l); err != nil { + fmt.Println("Error with upload one") return err } } else if err != nil { @@ -86,17 +94,22 @@ func Write(ref name.Reference, img v1.Image, auth authn.Authenticator, t http.Ro } else { // We *can* read the ConfigLayer, so upload it concurrently with the layers. g.Go(func() error { + fmt.Println("return uplaod one") + return w.uploadOne(l) }) // Wait for the layers + config. if err := g.Wait(); err != nil { + fmt.Println("Error with waiting again") return err } } // With all of the constituent elements uploaded, upload the manifest // to commit the image. + fmt.Println("Error with committing image?") + return w.commitImage(img) } @@ -270,6 +283,7 @@ func (w *writer) commitBlob(location, digest string) error { // uploadOne performs a complete upload of a single layer. func (w *writer) uploadOne(l v1.Layer) error { + fmt.Println("trying to uplaod one") var from, mount, digest string if _, ok := l.(*stream.Layer); !ok { // Layer isn't streamable, we should take advantage of that to @@ -302,10 +316,12 @@ func (w *writer) uploadOne(l v1.Layer) error { location, mounted, err := w.initiateUpload(from, mount) if err != nil { + fmt.Println("err initiating upload") return err } else if mounted { h, err := l.Digest() if err != nil { + fmt.Println("err getting digest") return err } log.Printf("mounted blob: %s", h.String()) @@ -314,20 +330,24 @@ func (w *writer) uploadOne(l v1.Layer) error { blob, err := l.Compressed() if err != nil { + fmt.Println("Err getting compressed") return err } location, err = w.streamBlob(blob, location) if err != nil { + fmt.Println("err streaming") return err } h, err := l.Digest() if err != nil { + fmt.Println("err digest again") return err } digest = h.String() if err := w.commitBlob(location, digest); err != nil { + fmt.Println("err commit blob again") return err } log.Printf("pushed blob: %s", digest)