Skip to content

Commit 7a7be2f

Browse files
authored
Merge pull request #3141 from ndeloof/path.IsAbs
use filepath.IsAbs to support windows paths
2 parents 9730a20 + c370f90 commit 7a7be2f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

bake/bake.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1360,8 +1360,8 @@ func toBuildOpt(t *Target, inp *Input) (*build.Options, error) {
13601360
if strings.HasPrefix(bi.ContextPath, "cwd://") {
13611361
bi.ContextPath = path.Clean(strings.TrimPrefix(bi.ContextPath, "cwd://"))
13621362
}
1363-
if !build.IsRemoteURL(bi.ContextPath) && bi.ContextState == nil && !path.IsAbs(bi.DockerfilePath) {
1364-
bi.DockerfilePath = path.Join(bi.ContextPath, bi.DockerfilePath)
1363+
if !build.IsRemoteURL(bi.ContextPath) && bi.ContextState == nil && !filepath.IsAbs(bi.DockerfilePath) {
1364+
bi.DockerfilePath = filepath.Join(bi.ContextPath, bi.DockerfilePath)
13651365
}
13661366
for k, v := range bi.NamedContexts {
13671367
if strings.HasPrefix(v.Path, "cwd://") {

bake/bake_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ func TestHCLContextCwdPrefix(t *testing.T) {
692692
require.Contains(t, m, "app")
693693
assert.Equal(t, "test", *m["app"].Dockerfile)
694694
assert.Equal(t, "foo", *m["app"].Context)
695-
assert.Equal(t, "foo/test", bo["app"].Inputs.DockerfilePath)
695+
assert.Equal(t, filepath.Clean("foo/test"), bo["app"].Inputs.DockerfilePath)
696696
assert.Equal(t, "foo", bo["app"].Inputs.ContextPath)
697697
}
698698

0 commit comments

Comments
 (0)