|
|
|
@ -25,6 +25,7 @@ var bakeTests = []func(t *testing.T, sb integration.Sandbox){
|
|
|
|
|
testBakeRemoteContextSubdir,
|
|
|
|
|
testBakeRemoteCmdContextEscapeRoot,
|
|
|
|
|
testBakeRemoteCmdContextEscapeRelative,
|
|
|
|
|
testBakeRemoteComposeInclude,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func testBakeLocal(t *testing.T, sb integration.Sandbox) {
|
|
|
|
@ -287,3 +288,47 @@ EOT
|
|
|
|
|
require.NoError(t, err, out)
|
|
|
|
|
require.FileExists(t, filepath.Join(dirDest, "foo"))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func testBakeRemoteComposeInclude(t *testing.T, sb integration.Sandbox) {
|
|
|
|
|
composeFile := []byte(`
|
|
|
|
|
include:
|
|
|
|
|
- compose-inc.yml
|
|
|
|
|
|
|
|
|
|
services:
|
|
|
|
|
foo:
|
|
|
|
|
build:
|
|
|
|
|
context: .
|
|
|
|
|
dockerfile_inline: |
|
|
|
|
|
FROM busybox
|
|
|
|
|
RUN echo foo
|
|
|
|
|
`)
|
|
|
|
|
composeIncFile := []byte(`
|
|
|
|
|
services:
|
|
|
|
|
inc:
|
|
|
|
|
build:
|
|
|
|
|
context: .
|
|
|
|
|
dockerfile_inline: |
|
|
|
|
|
FROM busybox
|
|
|
|
|
RUN echo inc
|
|
|
|
|
`)
|
|
|
|
|
|
|
|
|
|
dirSpec := tmpdir(
|
|
|
|
|
t,
|
|
|
|
|
fstest.CreateFile("compose.yml", composeFile, 0600),
|
|
|
|
|
fstest.CreateFile("compose-inc.yml", composeIncFile, 0600),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
git, err := gitutil.New(gitutil.WithWorkingDir(dirSpec))
|
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
|
|
gitutil.GitInit(git, t)
|
|
|
|
|
gitutil.GitAdd(git, t, "compose.yml", "compose-inc.yml")
|
|
|
|
|
gitutil.GitCommit(git, t, "initial commit")
|
|
|
|
|
addr := gitutil.GitServeHTTP(git, t)
|
|
|
|
|
|
|
|
|
|
out, err := bakeCmd(
|
|
|
|
|
sb,
|
|
|
|
|
withArgs(addr, "--set", "*.output=type=cacheonly"),
|
|
|
|
|
)
|
|
|
|
|
require.NoError(t, err, out)
|
|
|
|
|
}
|
|
|
|
|