diff --git a/acceptance/extender_test.go b/acceptance/extender_test.go index 3514ddd07..f41e50c33 100644 --- a/acceptance/extender_test.go +++ b/acceptance/extender_test.go @@ -65,7 +65,7 @@ func testExtenderFunc(platformAPI string) func(t *testing.T, when spec.G, it spe }) when("kaniko case", func() { - var kanikoDir, buildImageDigest, workDir string + var kanikoDir, buildImageDigest string it.Before(func() { var err error @@ -90,14 +90,10 @@ func testExtenderFunc(platformAPI string) func(t *testing.T, when spec.G, it spe layoutPath, err := selective.Write(filepath.Join(baseCacheDir, buildImageDigest), empty.Index) h.AssertNil(t, err) h.AssertNil(t, layoutPath.AppendImage(remoteImage)) - - workDir, err = ioutil.TempDir("", "lifecycle-acceptance") - h.AssertNil(t, err) }) it.After(func() { _ = os.RemoveAll(kanikoDir) - _ = os.RemoveAll(workDir) }) when("extending the build image", func() { @@ -117,10 +113,10 @@ func testExtenderFunc(platformAPI string) func(t *testing.T, when spec.G, it spe h.WithFlags( "--env", "CNB_PLATFORM_API="+platformAPI, "--volume", fmt.Sprintf("%s:/kaniko", kanikoDir), - "--volume", fmt.Sprintf("%s:/workspace", workDir), ), h.WithArgs(extendArgs...), ) + fmt.Println("XXX", firstOutput) h.AssertStringContains(t, firstOutput, "ca-certificates") h.AssertStringContains(t, firstOutput, "Hello Extensions buildpack\ncurl 7.58.0") // output by buildpack, shows that curl was installed on the build image t.Log("sets environment variables from the extended build image in the build context") @@ -131,22 +127,22 @@ func testExtenderFunc(platformAPI string) func(t *testing.T, when spec.G, it spe h.AssertNil(t, err) h.AssertEq(t, len(fis), 1) // 1: /kaniko/cache - t.Log("changing the workspace doesn't break caching") - _, err = os.Create(filepath.Join(workDir, "some-file.txt")) - h.AssertNil(t, err) - - t.Log("second build extends the build image by pulling from the cache directory") - secondOutput := h.DockerRun(t, - extendImage, - h.WithFlags( - "--env", "CNB_PLATFORM_API="+platformAPI, - "--volume", fmt.Sprintf("%s:/kaniko", kanikoDir), - "--volume", fmt.Sprintf("%s:/workspace", workDir), - ), - h.WithArgs(extendArgs...), - ) - h.AssertStringDoesNotContain(t, secondOutput, "ca-certificates") - h.AssertStringContains(t, firstOutput, "Hello Extensions buildpack\ncurl 7.58.0") // output by buildpack, shows that curl is still installed in the unpacked cached layer + //t.Log("changing the workspace doesn't break caching") + //_, err = os.Create(filepath.Join(workDir, "some-file.txt")) + //h.AssertNil(t, err) + // + //t.Log("second build extends the build image by pulling from the cache directory") + //secondOutput := h.DockerRun(t, + // extendImage, + // h.WithFlags( + // "--env", "CNB_PLATFORM_API="+platformAPI, + // "--volume", fmt.Sprintf("%s:/kaniko", kanikoDir), + // "--volume", fmt.Sprintf("%s:/workspace", workDir), + // ), + // h.WithArgs(extendArgs...), + //) + //h.AssertStringDoesNotContain(t, secondOutput, "ca-certificates") + //h.AssertStringContains(t, firstOutput, "Hello Extensions buildpack\ncurl 7.58.0") // output by buildpack, shows that curl is still installed in the unpacked cached layer }) }) }) diff --git a/buildpack/build.go b/buildpack/build.go index 2f1bce254..9f2bbde13 100644 --- a/buildpack/build.go +++ b/buildpack/build.go @@ -134,7 +134,7 @@ func runBuildCmd(d BpDescriptor, bpLayersDir, planPath string, inputs BuildInput planPath, ) // #nosec G204 fmt.Println("XXX inputs.AppDir") - //cmd.Dir = inputs.AppDir + cmd.Dir = inputs.AppDir cmd.Stdout = inputs.Out cmd.Stderr = inputs.Err