Merge 78616f2531 into 87e8e4b847
This commit is contained in:
@@ -21,6 +21,7 @@ var bakeTests = []func(t *testing.T, sb integration.Sandbox){
|
||||
testBakeLocal,
|
||||
testBakeRemote,
|
||||
testBakeRemoteCmdContext,
|
||||
testBakeRemoteLocalOverride,
|
||||
testBakeRemoteCmdContextOverride,
|
||||
testBakeRemoteContextSubdir,
|
||||
testBakeRemoteCmdContextEscapeRoot,
|
||||
@@ -48,6 +49,11 @@ target "default" {
|
||||
require.NoError(t, err, out)
|
||||
|
||||
require.FileExists(t, filepath.Join(dirDest, "foo"))
|
||||
|
||||
out, err = bakeCmd(sb, withDir(dir), withArgs("--file", "cwd://docker-bake.hcl", "--set", "*.output=type=local,dest="+dirDest))
|
||||
require.NoError(t, err, out)
|
||||
|
||||
require.FileExists(t, filepath.Join(dirDest, "foo"))
|
||||
}
|
||||
|
||||
func testBakeRemote(t *testing.T, sb integration.Sandbox) {
|
||||
@@ -80,6 +86,48 @@ EOT
|
||||
require.FileExists(t, filepath.Join(dirDest, "foo"))
|
||||
}
|
||||
|
||||
func testBakeRemoteLocalOverride(t *testing.T, sb integration.Sandbox) {
|
||||
remoteBakefile := []byte(`
|
||||
target "default" {
|
||||
dockerfile-inline = <<EOT
|
||||
FROM scratch
|
||||
COPY foo /foo
|
||||
EOT
|
||||
}
|
||||
`)
|
||||
localBakefile := []byte(`
|
||||
target "default" {
|
||||
dockerfile-inline = <<EOT
|
||||
FROM scratch
|
||||
COPY bar /bar
|
||||
EOT
|
||||
}
|
||||
`)
|
||||
dirSpec := tmpdir(
|
||||
t,
|
||||
fstest.CreateFile("docker-bake.hcl", remoteBakefile, 0600),
|
||||
fstest.CreateFile("bar", []byte("bar"), 0600),
|
||||
)
|
||||
dirSrc := tmpdir(
|
||||
t,
|
||||
fstest.CreateFile("local-docker-bake.hcl", localBakefile, 0600),
|
||||
)
|
||||
dirDest := t.TempDir()
|
||||
|
||||
git, err := gitutil.New(gitutil.WithWorkingDir(dirSpec))
|
||||
require.NoError(t, err)
|
||||
|
||||
gitutil.GitInit(git, t)
|
||||
gitutil.GitAdd(git, t, "docker-bake.hcl", "bar")
|
||||
gitutil.GitCommit(git, t, "initial commit")
|
||||
addr := gitutil.GitServeHTTP(git, t)
|
||||
|
||||
out, err := bakeCmd(sb, withDir(dirSrc), withArgs(addr, "--file", "cwd://local-docker-bake.hcl", "--set", "*.output=type=local,dest="+dirDest))
|
||||
require.NoError(t, err, out)
|
||||
|
||||
require.FileExists(t, filepath.Join(dirDest, "bar"))
|
||||
}
|
||||
|
||||
func testBakeRemoteCmdContext(t *testing.T, sb integration.Sandbox) {
|
||||
bakefile := []byte(`
|
||||
target "default" {
|
||||
|
||||
Reference in New Issue
Block a user