From 46578c15ef5d5e9939e2513fbf82d4120575ba3c Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Thu, 6 Apr 2023 09:47:21 -0400 Subject: [PATCH] Look for build Dockerfiles in the right directory Signed-off-by: Natalie Arellano --- internal/build/lifecycle_execution.go | 3 ++- internal/build/lifecycle_execution_test.go | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/build/lifecycle_execution.go b/internal/build/lifecycle_execution.go index ccad060a3..89f4f477f 100644 --- a/internal/build/lifecycle_execution.go +++ b/internal/build/lifecycle_execution.go @@ -813,7 +813,8 @@ func (l *LifecycleExecution) hasExtensions() bool { } func (l *LifecycleExecution) hasExtensionsForBuild() bool { - fis, err := os.ReadDir(filepath.Join(l.WorkingDir, "generated", "build")) + // the directory is /generated/build inside the build container, but `CopyOutTo` only copies the directory + fis, err := os.ReadDir(filepath.Join(l.WorkingDir, "build")) if err != nil { return false } diff --git a/internal/build/lifecycle_execution_test.go b/internal/build/lifecycle_execution_test.go index d1b0c2688..85fdcfb46 100644 --- a/internal/build/lifecycle_execution_test.go +++ b/internal/build/lifecycle_execution_test.go @@ -125,9 +125,10 @@ func testLifecycleExecution(t *testing.T, when spec.G, it spec.S) { lifecycle.WorkingDir, err = os.MkdirTemp("", "pack.unit") h.AssertNil(t, err) if extensionsForBuild { - err = os.MkdirAll(filepath.Join(lifecycle.WorkingDir, "generated", "build"), 0755) + // the directory is /generated/build inside the build container, but `CopyOutTo` only copies the directory + err = os.MkdirAll(filepath.Join(lifecycle.WorkingDir, "build"), 0755) h.AssertNil(t, err) - _, err = os.Create(filepath.Join(lifecycle.WorkingDir, "generated", "build", "some-dockerfile")) + _, err = os.Create(filepath.Join(lifecycle.WorkingDir, "build", "some-dockerfile")) h.AssertNil(t, err) } if extensionsForRun {