diff --git a/internal/build/lifecycle_execution.go b/internal/build/lifecycle_execution.go index ccad060a34..89f4f477fa 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 d1b0c2688b..85fdcfb468 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 {