Merge pull request #2191 from tonistiigi/integration-ctx
integration: add common context base to all integration testsv0.9
commit
6409a07898
|
@ -54,7 +54,7 @@ func TestClientGatewayIntegration(t *testing.T) {
|
||||||
func testClientGatewaySolve(t *testing.T, sb integration.Sandbox) {
|
func testClientGatewaySolve(t *testing.T, sb integration.Sandbox) {
|
||||||
requiresLinux(t)
|
requiresLinux(t)
|
||||||
|
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := New(ctx, sb.Address())
|
c, err := New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -132,7 +132,7 @@ func testClientGatewaySolve(t *testing.T, sb integration.Sandbox) {
|
||||||
func testClientGatewayFailedSolve(t *testing.T, sb integration.Sandbox) {
|
func testClientGatewayFailedSolve(t *testing.T, sb integration.Sandbox) {
|
||||||
requiresLinux(t)
|
requiresLinux(t)
|
||||||
|
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := New(ctx, sb.Address())
|
c, err := New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -150,7 +150,7 @@ func testClientGatewayFailedSolve(t *testing.T, sb integration.Sandbox) {
|
||||||
func testClientGatewayEmptySolve(t *testing.T, sb integration.Sandbox) {
|
func testClientGatewayEmptySolve(t *testing.T, sb integration.Sandbox) {
|
||||||
requiresLinux(t)
|
requiresLinux(t)
|
||||||
|
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := New(ctx, sb.Address())
|
c, err := New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -174,7 +174,7 @@ func testClientGatewayEmptySolve(t *testing.T, sb integration.Sandbox) {
|
||||||
func testNoBuildID(t *testing.T, sb integration.Sandbox) {
|
func testNoBuildID(t *testing.T, sb integration.Sandbox) {
|
||||||
requiresLinux(t)
|
requiresLinux(t)
|
||||||
|
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := New(ctx, sb.Address())
|
c, err := New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -189,7 +189,7 @@ func testNoBuildID(t *testing.T, sb integration.Sandbox) {
|
||||||
func testUnknownBuildID(t *testing.T, sb integration.Sandbox) {
|
func testUnknownBuildID(t *testing.T, sb integration.Sandbox) {
|
||||||
requiresLinux(t)
|
requiresLinux(t)
|
||||||
|
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := New(ctx, sb.Address())
|
c, err := New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -206,7 +206,7 @@ func testUnknownBuildID(t *testing.T, sb integration.Sandbox) {
|
||||||
func testClientGatewayContainerCancelOnRelease(t *testing.T, sb integration.Sandbox) {
|
func testClientGatewayContainerCancelOnRelease(t *testing.T, sb integration.Sandbox) {
|
||||||
requiresLinux(t)
|
requiresLinux(t)
|
||||||
|
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := New(ctx, sb.Address())
|
c, err := New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -279,7 +279,7 @@ func testClientGatewayContainerCancelOnRelease(t *testing.T, sb integration.Sand
|
||||||
func testClientGatewayContainerExecPipe(t *testing.T, sb integration.Sandbox) {
|
func testClientGatewayContainerExecPipe(t *testing.T, sb integration.Sandbox) {
|
||||||
requiresLinux(t)
|
requiresLinux(t)
|
||||||
|
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := New(ctx, sb.Address())
|
c, err := New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -405,7 +405,7 @@ func testClientGatewayContainerExecPipe(t *testing.T, sb integration.Sandbox) {
|
||||||
func testClientGatewayContainerPID1Fail(t *testing.T, sb integration.Sandbox) {
|
func testClientGatewayContainerPID1Fail(t *testing.T, sb integration.Sandbox) {
|
||||||
requiresLinux(t)
|
requiresLinux(t)
|
||||||
|
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := New(ctx, sb.Address())
|
c, err := New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -469,7 +469,7 @@ func testClientGatewayContainerPID1Fail(t *testing.T, sb integration.Sandbox) {
|
||||||
func testClientGatewayContainerPID1Exit(t *testing.T, sb integration.Sandbox) {
|
func testClientGatewayContainerPID1Exit(t *testing.T, sb integration.Sandbox) {
|
||||||
requiresLinux(t)
|
requiresLinux(t)
|
||||||
|
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := New(ctx, sb.Address())
|
c, err := New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -542,7 +542,7 @@ func testClientGatewayContainerPID1Exit(t *testing.T, sb integration.Sandbox) {
|
||||||
func testClientGatewayContainerMounts(t *testing.T, sb integration.Sandbox) {
|
func testClientGatewayContainerMounts(t *testing.T, sb integration.Sandbox) {
|
||||||
requiresLinux(t)
|
requiresLinux(t)
|
||||||
|
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := New(ctx, sb.Address())
|
c, err := New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -714,7 +714,7 @@ func testClientGatewayContainerMounts(t *testing.T, sb integration.Sandbox) {
|
||||||
// a container pid1, executor.Run
|
// a container pid1, executor.Run
|
||||||
func testClientGatewayContainerPID1Tty(t *testing.T, sb integration.Sandbox) {
|
func testClientGatewayContainerPID1Tty(t *testing.T, sb integration.Sandbox) {
|
||||||
requiresLinux(t)
|
requiresLinux(t)
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := New(ctx, sb.Address())
|
c, err := New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -852,7 +852,7 @@ func (p *testPrompt) wait(msg string) string {
|
||||||
// executor.Exec (secondary process)
|
// executor.Exec (secondary process)
|
||||||
func testClientGatewayContainerExecTty(t *testing.T, sb integration.Sandbox) {
|
func testClientGatewayContainerExecTty(t *testing.T, sb integration.Sandbox) {
|
||||||
requiresLinux(t)
|
requiresLinux(t)
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := New(ctx, sb.Address())
|
c, err := New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -940,7 +940,7 @@ func testClientGatewayContainerExecTty(t *testing.T, sb integration.Sandbox) {
|
||||||
func testClientSlowCacheRootfsRef(t *testing.T, sb integration.Sandbox) {
|
func testClientSlowCacheRootfsRef(t *testing.T, sb integration.Sandbox) {
|
||||||
requiresLinux(t)
|
requiresLinux(t)
|
||||||
|
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := New(ctx, sb.Address())
|
c, err := New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -1007,7 +1007,7 @@ func testClientSlowCacheRootfsRef(t *testing.T, sb integration.Sandbox) {
|
||||||
// gets set for the requested platform
|
// gets set for the requested platform
|
||||||
func testClientGatewayContainerPlatformPATH(t *testing.T, sb integration.Sandbox) {
|
func testClientGatewayContainerPlatformPATH(t *testing.T, sb integration.Sandbox) {
|
||||||
requiresLinux(t)
|
requiresLinux(t)
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := New(ctx, sb.Address())
|
c, err := New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -1079,7 +1079,7 @@ func testClientGatewayContainerPlatformPATH(t *testing.T, sb integration.Sandbox
|
||||||
func testClientGatewayExecError(t *testing.T, sb integration.Sandbox) {
|
func testClientGatewayExecError(t *testing.T, sb integration.Sandbox) {
|
||||||
requiresLinux(t)
|
requiresLinux(t)
|
||||||
|
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := New(ctx, sb.Address())
|
c, err := New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -1236,7 +1236,7 @@ func testClientGatewayExecError(t *testing.T, sb integration.Sandbox) {
|
||||||
func testClientGatewaySlowCacheExecError(t *testing.T, sb integration.Sandbox) {
|
func testClientGatewaySlowCacheExecError(t *testing.T, sb integration.Sandbox) {
|
||||||
requiresLinux(t)
|
requiresLinux(t)
|
||||||
|
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := New(ctx, sb.Address())
|
c, err := New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -1327,7 +1327,7 @@ func testClientGatewaySlowCacheExecError(t *testing.T, sb integration.Sandbox) {
|
||||||
func testClientGatewayExecFileActionError(t *testing.T, sb integration.Sandbox) {
|
func testClientGatewayExecFileActionError(t *testing.T, sb integration.Sandbox) {
|
||||||
requiresLinux(t)
|
requiresLinux(t)
|
||||||
|
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := New(ctx, sb.Address())
|
c, err := New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -34,7 +34,7 @@ func testBuildWithLocalFiles(t *testing.T, sb integration.Sandbox) {
|
||||||
|
|
||||||
st.AddMount("/mnt", llb.Local("src"), llb.Readonly)
|
st.AddMount("/mnt", llb.Local("src"), llb.Readonly)
|
||||||
|
|
||||||
rdr, err := marshal(st.Root())
|
rdr, err := marshal(sb.Context(), st.Root())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
cmd := sb.Cmd(fmt.Sprintf("build --progress=plain --local src=%s", dir))
|
cmd := sb.Cmd(fmt.Sprintf("build --progress=plain --local src=%s", dir))
|
||||||
|
@ -50,7 +50,7 @@ func testBuildLocalExporter(t *testing.T, sb integration.Sandbox) {
|
||||||
|
|
||||||
out := st.AddMount("/out", llb.Scratch())
|
out := st.AddMount("/out", llb.Scratch())
|
||||||
|
|
||||||
rdr, err := marshal(out)
|
rdr, err := marshal(sb.Context(), out)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
tmpdir, err := ioutil.TempDir("", "buildkit-buildctl")
|
tmpdir, err := ioutil.TempDir("", "buildkit-buildctl")
|
||||||
|
@ -77,7 +77,7 @@ func testBuildContainerdExporter(t *testing.T, sb integration.Sandbox) {
|
||||||
st := llb.Image("busybox").
|
st := llb.Image("busybox").
|
||||||
Run(llb.Shlex("sh -c 'echo -n bar > /foo'"))
|
Run(llb.Shlex("sh -c 'echo -n bar > /foo'"))
|
||||||
|
|
||||||
rdr, err := marshal(st.Root())
|
rdr, err := marshal(sb.Context(), st.Root())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
imageName := "example.com/moby/imageexporter:test"
|
imageName := "example.com/moby/imageexporter:test"
|
||||||
|
@ -116,7 +116,7 @@ func testBuildMetadataFile(t *testing.T, sb integration.Sandbox) {
|
||||||
st := llb.Image("busybox").
|
st := llb.Image("busybox").
|
||||||
Run(llb.Shlex("sh -c 'echo -n bar > /foo'"))
|
Run(llb.Shlex("sh -c 'echo -n bar > /foo'"))
|
||||||
|
|
||||||
rdr, err := marshal(st.Root())
|
rdr, err := marshal(sb.Context(), st.Root())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
tmpDir, err := ioutil.TempDir("", "buildkit-buildctl")
|
tmpDir, err := ioutil.TempDir("", "buildkit-buildctl")
|
||||||
|
@ -167,8 +167,8 @@ func testBuildMetadataFile(t *testing.T, sb integration.Sandbox) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func marshal(st llb.State) (io.Reader, error) {
|
func marshal(ctx context.Context, st llb.State) (io.Reader, error) {
|
||||||
def, err := st.Marshal(context.TODO())
|
def, err := st.Marshal(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
package dockerfile
|
package dockerfile
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -73,7 +72,7 @@ COPY --from=build /dest /
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
|
@ -81,7 +80,7 @@ COPY --from=build /dest /
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(destDir)
|
defer os.RemoveAll(destDir)
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
Exports: []client.ExportEntry{
|
Exports: []client.ExportEntry{
|
||||||
{
|
{
|
||||||
Type: client.ExporterLocal,
|
Type: client.ExporterLocal,
|
||||||
|
@ -130,7 +129,7 @@ COPY --from=build /dest /dest
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
|
@ -138,7 +137,7 @@ COPY --from=build /dest /dest
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(destDir)
|
defer os.RemoveAll(destDir)
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
Exports: []client.ExportEntry{
|
Exports: []client.ExportEntry{
|
||||||
{
|
{
|
||||||
Type: client.ExporterLocal,
|
Type: client.ExporterLocal,
|
||||||
|
@ -180,7 +179,7 @@ COPY --from=build /dest /dest
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
|
@ -188,7 +187,7 @@ COPY --from=build /dest /dest
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(destDir)
|
defer os.RemoveAll(destDir)
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
Exports: []client.ExportEntry{
|
Exports: []client.ExportEntry{
|
||||||
{
|
{
|
||||||
Type: client.ExporterLocal,
|
Type: client.ExporterLocal,
|
||||||
|
@ -231,7 +230,7 @@ COPY --from=build /dest /dest
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
|
@ -239,7 +238,7 @@ COPY --from=build /dest /dest
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(destDir)
|
defer os.RemoveAll(destDir)
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
Exports: []client.ExportEntry{
|
Exports: []client.ExportEntry{
|
||||||
{
|
{
|
||||||
Type: client.ExporterLocal,
|
Type: client.ExporterLocal,
|
||||||
|
@ -296,7 +295,7 @@ COPY --from=build /dest /
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
|
@ -304,7 +303,7 @@ COPY --from=build /dest /
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(destDir)
|
defer os.RemoveAll(destDir)
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
Exports: []client.ExportEntry{
|
Exports: []client.ExportEntry{
|
||||||
{
|
{
|
||||||
Type: client.ExporterLocal,
|
Type: client.ExporterLocal,
|
||||||
|
@ -388,7 +387,7 @@ COPY --from=build /dest /
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
|
@ -396,7 +395,7 @@ COPY --from=build /dest /
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(destDir)
|
defer os.RemoveAll(destDir)
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
Exports: []client.ExportEntry{
|
Exports: []client.ExportEntry{
|
||||||
{
|
{
|
||||||
Type: client.ExporterLocal,
|
Type: client.ExporterLocal,
|
||||||
|
@ -465,7 +464,7 @@ COPY --from=build /dest /
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
|
@ -473,7 +472,7 @@ COPY --from=build /dest /
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(destDir)
|
defer os.RemoveAll(destDir)
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
Exports: []client.ExportEntry{
|
Exports: []client.ExportEntry{
|
||||||
{
|
{
|
||||||
Type: client.ExporterLocal,
|
Type: client.ExporterLocal,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package dockerfile
|
package dockerfile
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -48,11 +47,11 @@ RUN --mount=target=/context [ "$(cat /context/testfile)" == "contents0" ]
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.DefaultLocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.DefaultLocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
|
@ -76,11 +75,11 @@ RUN [ ! -f /mytmp/foo ]
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.DefaultLocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.DefaultLocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
|
@ -111,7 +110,7 @@ COPY --from=second /unique /unique
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
|
@ -119,7 +118,7 @@ COPY --from=second /unique /unique
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(destDir)
|
defer os.RemoveAll(destDir)
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
Exports: []client.ExportEntry{
|
Exports: []client.ExportEntry{
|
||||||
{
|
{
|
||||||
Type: client.ExporterLocal,
|
Type: client.ExporterLocal,
|
||||||
|
@ -148,7 +147,7 @@ COPY --from=second /unique /unique
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(destDir)
|
defer os.RemoveAll(destDir)
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
Exports: []client.ExportEntry{
|
Exports: []client.ExportEntry{
|
||||||
{
|
{
|
||||||
Type: client.ExporterLocal,
|
Type: client.ExporterLocal,
|
||||||
|
@ -182,11 +181,11 @@ RUN --mount=type=cache,target=/mycache,uid=1001,gid=1002,mode=0751 [ "$(stat -c
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
FrontendAttrs: map[string]string{
|
FrontendAttrs: map[string]string{
|
||||||
"build-arg:BUILDKIT_DISABLE_FILEOP": strconv.FormatBool(!isFileOp),
|
"build-arg:BUILDKIT_DISABLE_FILEOP": strconv.FormatBool(!isFileOp),
|
||||||
},
|
},
|
||||||
|
@ -214,11 +213,11 @@ RUN --mount=type=cache,target=/mycache [ -f /mycache/foo ]
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.DefaultLocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.DefaultLocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
|
@ -243,11 +242,11 @@ RUN --mount=type=cache,target=$SOME_PATH [ -f $SOME_PATH/foo ]
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.DefaultLocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.DefaultLocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
|
@ -272,11 +271,11 @@ RUN --mount=type=cache,target=/mycache2 [ -f /mycache2/foo ]
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.DefaultLocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.DefaultLocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
|
@ -306,11 +305,11 @@ RUN --mount=type=$MNT_TYPE2,id=$MNT_ID,target=/whatever [ -f /whatever/foo ]
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.DefaultLocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.DefaultLocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
|
@ -337,11 +336,11 @@ RUN --mount=type=cache,id=mycache,target=$META_PATH [ -f /tmp/meta/foo ]
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.DefaultLocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.DefaultLocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
|
@ -368,11 +367,11 @@ RUN --mount=from=$ttt,type=cache,target=/tmp ls
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.DefaultLocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.DefaultLocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
package dockerfile
|
package dockerfile
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -50,11 +49,11 @@ RUN ip link show eth0
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.DefaultLocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.DefaultLocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
|
@ -86,11 +85,11 @@ RUN --network=none ! ip link show eth0
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.DefaultLocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.DefaultLocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
|
@ -127,11 +126,11 @@ RUN --network=host nc 127.0.0.1 %s | grep foo
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.DefaultLocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.DefaultLocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
|
@ -171,11 +170,11 @@ RUN --network=none ! nc -z 127.0.0.1 %s
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.DefaultLocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.DefaultLocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
package dockerfile
|
package dockerfile
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
@ -65,11 +64,11 @@ RUN --security=insecure ls -l /dev && dd if=/dev/zero of=disk.img bs=20M count=1
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.DefaultLocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.DefaultLocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
|
@ -104,11 +103,11 @@ RUN [ "$(cat /proc/self/status | grep CapBnd)" == "CapBnd: 00000000a80425fb" ]
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.DefaultLocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.DefaultLocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
|
@ -142,11 +141,11 @@ RUN --security=sandbox [ "$(cat /proc/self/status | grep CapBnd)" == "CapBnd: 00
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.DefaultLocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.DefaultLocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
|
@ -170,11 +169,11 @@ RUN [ "$(cat /proc/self/status | grep CapBnd)" == "CapBnd: 00000000a80425fb" ]
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.DefaultLocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.DefaultLocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package dockerfile
|
package dockerfile
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
@ -37,11 +36,11 @@ RUN [ ! -f /mysecret ] # check no stub left behind
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.DefaultLocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.DefaultLocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package dockerfile
|
package dockerfile
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/rsa"
|
"crypto/rsa"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
|
@ -42,7 +41,7 @@ RUN --mount=type=ssh,mode=741,uid=100,gid=102 [ "$(stat -c "%u %g %f" $SSH_AUTH_
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
|
@ -68,7 +67,7 @@ RUN --mount=type=ssh,mode=741,uid=100,gid=102 [ "$(stat -c "%u %g %f" $SSH_AUTH_
|
||||||
}})
|
}})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.DefaultLocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.DefaultLocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,6 @@
|
||||||
package dockerfile
|
package dockerfile
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -83,11 +82,11 @@ env bar=baz`,
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
c, err := client.New(context.TODO(), sb.Address())
|
c, err := client.New(sb.Context(), sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.DefaultLocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.DefaultLocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
|
|
|
@ -37,7 +37,7 @@ func TestFrontendIntegration(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testReturnNil(t *testing.T, sb integration.Sandbox) {
|
func testReturnNil(t *testing.T, sb integration.Sandbox) {
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := client.New(ctx, sb.Address())
|
c, err := client.New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -63,7 +63,7 @@ func testReturnNil(t *testing.T, sb integration.Sandbox) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testRefReadFile(t *testing.T, sb integration.Sandbox) {
|
func testRefReadFile(t *testing.T, sb integration.Sandbox) {
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := client.New(ctx, sb.Address())
|
c, err := client.New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -128,7 +128,7 @@ func testRefReadFile(t *testing.T, sb integration.Sandbox) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testRefReadDir(t *testing.T, sb integration.Sandbox) {
|
func testRefReadDir(t *testing.T, sb integration.Sandbox) {
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := client.New(ctx, sb.Address())
|
c, err := client.New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -244,7 +244,7 @@ func testRefReadDir(t *testing.T, sb integration.Sandbox) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testRefStatFile(t *testing.T, sb integration.Sandbox) {
|
func testRefStatFile(t *testing.T, sb integration.Sandbox) {
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := client.New(ctx, sb.Address())
|
c, err := client.New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package solver
|
package solver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -33,7 +32,7 @@ func TestJobsIntegration(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testParallelism(t *testing.T, sb integration.Sandbox) {
|
func testParallelism(t *testing.T, sb integration.Sandbox) {
|
||||||
ctx := context.TODO()
|
ctx := sb.Context()
|
||||||
|
|
||||||
c, err := client.New(ctx, sb.Address())
|
c, err := client.New(ctx, sb.Address())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
|
@ -2,6 +2,7 @@ package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
|
@ -58,7 +59,7 @@ func (c *containerd) Name() string {
|
||||||
return c.name
|
return c.name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *containerd) New(cfg *BackendConfig) (b Backend, cl func() error, err error) {
|
func (c *containerd) New(ctx context.Context, cfg *BackendConfig) (b Backend, cl func() error, err error) {
|
||||||
if err := lookupBinary(c.containerd); err != nil {
|
if err := lookupBinary(c.containerd); err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
@ -147,7 +148,7 @@ disabled_plugins = ["cri"]
|
||||||
"--containerd-worker-labels=org.mobyproject.buildkit.worker.sandbox=true", // Include use of --containerd-worker-labels to trigger https://github.com/moby/buildkit/pull/603
|
"--containerd-worker-labels=org.mobyproject.buildkit.worker.sandbox=true", // Include use of --containerd-worker-labels to trigger https://github.com/moby/buildkit/pull/603
|
||||||
}, snBuildkitdArgs...)
|
}, snBuildkitdArgs...)
|
||||||
|
|
||||||
buildkitdSock, stop, err := runBuildkitd(cfg, buildkitdArgs, cfg.Logs, 0, 0, c.extraEnv)
|
buildkitdSock, stop, err := runBuildkitd(ctx, cfg, buildkitdArgs, cfg.Logs, 0, 0, c.extraEnv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
printLogs(cfg.Logs, log.Println)
|
printLogs(cfg.Logs, log.Println)
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
|
|
@ -40,7 +40,7 @@ func (c dockerd) Name() string {
|
||||||
return dockerdBinary
|
return dockerdBinary
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c dockerd) New(cfg *BackendConfig) (b Backend, cl func() error, err error) {
|
func (c dockerd) New(ctx context.Context, cfg *BackendConfig) (b Backend, cl func() error, err error) {
|
||||||
if err := requireRoot(); err != nil {
|
if err := requireRoot(); err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package integration
|
package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
@ -44,7 +45,7 @@ func (s *oci) Name() string {
|
||||||
return "oci"
|
return "oci"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *oci) New(cfg *BackendConfig) (Backend, func() error, error) {
|
func (s *oci) New(ctx context.Context, cfg *BackendConfig) (Backend, func() error, error) {
|
||||||
if err := lookupBinary("buildkitd"); err != nil {
|
if err := lookupBinary("buildkitd"); err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
@ -67,7 +68,7 @@ func (s *oci) New(cfg *BackendConfig) (Backend, func() error, error) {
|
||||||
buildkitdArgs = append([]string{"sudo", "-u", fmt.Sprintf("#%d", s.uid), "-i", "--", "exec", "rootlesskit"}, buildkitdArgs...)
|
buildkitdArgs = append([]string{"sudo", "-u", fmt.Sprintf("#%d", s.uid), "-i", "--", "exec", "rootlesskit"}, buildkitdArgs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
buildkitdSock, stop, err := runBuildkitd(cfg, buildkitdArgs, cfg.Logs, s.uid, s.gid, nil)
|
buildkitdSock, stop, err := runBuildkitd(ctx, cfg, buildkitdArgs, cfg.Logs, s.uid, s.gid, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
printLogs(cfg.Logs, log.Println)
|
printLogs(cfg.Logs, log.Println)
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
|
|
@ -20,6 +20,7 @@ import (
|
||||||
"github.com/containerd/containerd/content"
|
"github.com/containerd/containerd/content"
|
||||||
"github.com/containerd/containerd/remotes/docker"
|
"github.com/containerd/containerd/remotes/docker"
|
||||||
"github.com/gofrs/flock"
|
"github.com/gofrs/flock"
|
||||||
|
"github.com/moby/buildkit/util/appcontext"
|
||||||
"github.com/moby/buildkit/util/contentutil"
|
"github.com/moby/buildkit/util/contentutil"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -45,6 +46,7 @@ type Backend interface {
|
||||||
type Sandbox interface {
|
type Sandbox interface {
|
||||||
Backend
|
Backend
|
||||||
|
|
||||||
|
Context() context.Context
|
||||||
Cmd(...string) *exec.Cmd
|
Cmd(...string) *exec.Cmd
|
||||||
PrintLogs(*testing.T)
|
PrintLogs(*testing.T)
|
||||||
NewRegistry() (string, error)
|
NewRegistry() (string, error)
|
||||||
|
@ -58,7 +60,7 @@ type BackendConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Worker interface {
|
type Worker interface {
|
||||||
New(*BackendConfig) (Backend, func() error, error)
|
New(context.Context, *BackendConfig) (Backend, func() error, error)
|
||||||
Name() string
|
Name() string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,6 +156,8 @@ func Run(t *testing.T, testCases []Test, opt ...TestOpt) {
|
||||||
name := fn + "/worker=" + br.Name() + mv.functionSuffix()
|
name := fn + "/worker=" + br.Name() + mv.functionSuffix()
|
||||||
func(fn, testName string, br Worker, tc Test, mv matrixValue) {
|
func(fn, testName string, br Worker, tc Test, mv matrixValue) {
|
||||||
ok := t.Run(testName, func(t *testing.T) {
|
ok := t.Run(testName, func(t *testing.T) {
|
||||||
|
ctx := appcontext.Context()
|
||||||
|
|
||||||
defer cleanOnComplete()()
|
defer cleanOnComplete()()
|
||||||
if !strings.HasSuffix(fn, "NoParallel") {
|
if !strings.HasSuffix(fn, "NoParallel") {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
@ -161,7 +165,7 @@ func Run(t *testing.T, testCases []Test, opt ...TestOpt) {
|
||||||
require.NoError(t, sandboxLimiter.Acquire(context.TODO(), 1))
|
require.NoError(t, sandboxLimiter.Acquire(context.TODO(), 1))
|
||||||
defer sandboxLimiter.Release(1)
|
defer sandboxLimiter.Release(1)
|
||||||
|
|
||||||
sb, closer, err := newSandbox(br, mirror, mv)
|
sb, closer, err := newSandbox(ctx, br, mirror, mv)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
assert.NoError(t, closer())
|
assert.NoError(t, closer())
|
||||||
|
|
|
@ -3,6 +3,7 @@ package integration
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
@ -49,6 +50,11 @@ type sandbox struct {
|
||||||
logs map[string]*bytes.Buffer
|
logs map[string]*bytes.Buffer
|
||||||
cleanup *multiCloser
|
cleanup *multiCloser
|
||||||
mv matrixValue
|
mv matrixValue
|
||||||
|
ctx context.Context
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sb *sandbox) Context() context.Context {
|
||||||
|
return sb.ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sb *sandbox) PrintLogs(t *testing.T) {
|
func (sb *sandbox) PrintLogs(t *testing.T) {
|
||||||
|
@ -80,7 +86,7 @@ func (sb *sandbox) Value(k string) interface{} {
|
||||||
return sb.mv.values[k].value
|
return sb.mv.values[k].value
|
||||||
}
|
}
|
||||||
|
|
||||||
func newSandbox(w Worker, mirror string, mv matrixValue) (s Sandbox, cl func() error, err error) {
|
func newSandbox(ctx context.Context, w Worker, mirror string, mv matrixValue) (s Sandbox, cl func() error, err error) {
|
||||||
cfg := &BackendConfig{
|
cfg := &BackendConfig{
|
||||||
Logs: make(map[string]*bytes.Buffer),
|
Logs: make(map[string]*bytes.Buffer),
|
||||||
}
|
}
|
||||||
|
@ -117,7 +123,7 @@ func newSandbox(w Worker, mirror string, mv matrixValue) (s Sandbox, cl func() e
|
||||||
cfg.ConfigFile = filepath.Join(dir, buildkitdConfigFile)
|
cfg.ConfigFile = filepath.Join(dir, buildkitdConfigFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
b, closer, err := w.New(cfg)
|
b, closer, err := w.New(ctx, cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
@ -128,6 +134,7 @@ func newSandbox(w Worker, mirror string, mv matrixValue) (s Sandbox, cl func() e
|
||||||
logs: cfg.Logs,
|
logs: cfg.Logs,
|
||||||
cleanup: deferF,
|
cleanup: deferF,
|
||||||
mv: mv,
|
mv: mv,
|
||||||
|
ctx: ctx,
|
||||||
}, cl, nil
|
}, cl, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +146,7 @@ func getBuildkitdAddr(tmpdir string) string {
|
||||||
return address
|
return address
|
||||||
}
|
}
|
||||||
|
|
||||||
func runBuildkitd(conf *BackendConfig, args []string, logs map[string]*bytes.Buffer, uid, gid int, extraEnv []string) (address string, cl func() error, err error) {
|
func runBuildkitd(ctx context.Context, conf *BackendConfig, args []string, logs map[string]*bytes.Buffer, uid, gid int, extraEnv []string) (address string, cl func() error, err error) {
|
||||||
deferF := &multiCloser{}
|
deferF := &multiCloser{}
|
||||||
cl = deferF.F()
|
cl = deferF.F()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue