Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix propagation of buildpacks working directory #4337

Merged
merged 1 commit into from
Jun 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/skaffold/debug/cnb.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ func updateForCNBImage(container *v1.Container, ic imageConfiguration, transform
}

c, img, err := transformer(container, ic)
// must explicitly modify the working dir as the imageConfig is lost after we return
if c.WorkingDir == "" {
c.WorkingDir = ic.workingDir
}

// Only rewrite the container.Args if set: some transforms only alter env vars,
// and the image's arguments are not changed.
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/debug/cnb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func TestUpdateForCNBImage(t *testing.T) {
testutil.Run(t, test.description+" (args changed)", func(t *testutil.T) {
argsChangedTransform := func(c *v1.Container, ic imageConfiguration) (ContainerDebugConfiguration, string, error) {
c.Args = ic.arguments
return ContainerDebugConfiguration{WorkingDir: ic.workingDir}, "", nil
return ContainerDebugConfiguration{}, "", nil
}
copy := v1.Container{}
c, _, err := updateForCNBImage(&copy, test.input, argsChangedTransform)
Expand Down