Skip to content

Commit

Permalink
Look for build Dockerfiles in the right directory
Browse files Browse the repository at this point in the history
Signed-off-by: Natalie Arellano <narellano@vmware.com>
  • Loading branch information
natalieparellano committed Apr 6, 2023
1 parent cbd7dd1 commit 46578c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion internal/build/lifecycle_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <layers>/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
}
Expand Down
5 changes: 3 additions & 2 deletions internal/build/lifecycle_execution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <layers>/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 {
Expand Down

0 comments on commit 46578c1

Please sign in to comment.