|
|
|
@ -20,6 +20,7 @@ func bakeCmd(sb integration.Sandbox, dir string, args ...string) (string, error)
|
|
|
|
|
|
|
|
|
|
var bakeTests = []func(t *testing.T, sb integration.Sandbox){
|
|
|
|
|
testBakeRemote,
|
|
|
|
|
testBakeRemoteCmdContext,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func testBakeRemote(t *testing.T, sb integration.Sandbox) {
|
|
|
|
@ -51,3 +52,37 @@ EOT
|
|
|
|
|
|
|
|
|
|
require.FileExists(t, filepath.Join(dirDest, "foo"))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func testBakeRemoteCmdContext(t *testing.T, sb integration.Sandbox) {
|
|
|
|
|
bakefile := []byte(`
|
|
|
|
|
target "default" {
|
|
|
|
|
context = BAKE_CMD_CONTEXT
|
|
|
|
|
dockerfile-inline = <<EOT
|
|
|
|
|
FROM scratch
|
|
|
|
|
COPY foo /foo
|
|
|
|
|
EOT
|
|
|
|
|
}
|
|
|
|
|
`)
|
|
|
|
|
dirSpec := tmpdir(
|
|
|
|
|
t,
|
|
|
|
|
fstest.CreateFile("docker-bake.hcl", bakefile, 0600),
|
|
|
|
|
)
|
|
|
|
|
dirSrc := tmpdir(
|
|
|
|
|
t,
|
|
|
|
|
fstest.CreateFile("foo", []byte("foo"), 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")
|
|
|
|
|
gitutil.GitCommit(git, t, "initial commit")
|
|
|
|
|
addr := gitutil.GitServeHTTP(git, t)
|
|
|
|
|
|
|
|
|
|
out, err := bakeCmd(sb, dirSrc, addr, "--set", "*.output=type=local,dest="+dirDest)
|
|
|
|
|
require.NoError(t, err, out)
|
|
|
|
|
|
|
|
|
|
require.FileExists(t, filepath.Join(dirDest, "foo"))
|
|
|
|
|
}
|
|
|
|
|