Skip to content

Commit

Permalink
test: details link support in experimental mode
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <[email protected]>
  • Loading branch information
crazy-max committed Oct 8, 2024
1 parent d353f5f commit 052caaa
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
32 changes: 15 additions & 17 deletions tests/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,47 +461,45 @@ RUN busybox | head -1 | grep v1.36.1

func testBuildDetailsLink(t *testing.T, sb integration.Sandbox) {
skipNoCompatBuildKit(t, sb, ">= 0.11.0-0", "build details link")
home := t.TempDir()
buildDetailsPattern := regexp.MustCompile(`(?m)^View build details: docker-desktop://dashboard/build/[^/]+/[^/]+/[^/]+\n$`)

// build simple dockerfile
dockerfile := []byte(`FROM busybox:latest
RUN echo foo > /bar`)
dir := tmpdir(t, fstest.CreateFile("Dockerfile", dockerfile, 0600))
cmd := buildxCmd(sb, withArgs("build", "--output=type=cacheonly", dir))
cmd := buildxCmd(sb,
withArgs("build", "--output=type=cacheonly", dir),
withEnv(fmt.Sprintf("HOME=%s", home)),
)
out, err := cmd.CombinedOutput()
require.NoError(t, err, string(out))
require.False(t, buildDetailsPattern.MatchString(string(out)), fmt.Sprintf("build details link not expected in output, got %q", out))

// create desktop-build .lastaccess file
home, err := os.UserHomeDir() // TODO: sandbox should create a temp home dir and expose it through its interface
require.NoError(t, err)
dbDir := path.Join(home, ".docker", "desktop-build")
require.NoError(t, os.MkdirAll(dbDir, 0755))
dblaFile, err := os.Create(path.Join(dbDir, ".lastaccess"))
dblaLastaccess, err := os.Create(path.Join(dbDir, ".lastaccess"))
require.NoError(t, err)
defer func() {
dblaFile.Close()
if err := os.Remove(dblaFile.Name()); err != nil {
t.Fatal(err)
}
}()
require.NoError(t, dblaLastaccess.Close())

// build again
cmd = buildxCmd(sb, withArgs("build", "--output=type=cacheonly", dir))
cmd = buildxCmd(sb,
withArgs("build", "--output=type=cacheonly", dir),
withEnv(fmt.Sprintf("HOME=%s", home)),
)
out, err = cmd.CombinedOutput()
require.NoError(t, err, string(out))
require.True(t, buildDetailsPattern.MatchString(string(out)), fmt.Sprintf("expected build details link in output, got %q", out))

if isExperimental() {
// FIXME: https://github.com/docker/buildx/issues/2382
t.Skip("build details link not displayed in experimental mode when build fails: https://github.com/docker/buildx/issues/2382")
}

// build erroneous dockerfile
dockerfile = []byte(`FROM busybox:latest
RUN exit 1`)
dir = tmpdir(t, fstest.CreateFile("Dockerfile", dockerfile, 0600))
cmd = buildxCmd(sb, withArgs("build", "--output=type=cacheonly", dir))
cmd = buildxCmd(sb,
withArgs("build", "--output=type=cacheonly", dir),
withEnv(fmt.Sprintf("HOME=%s", home)),
)
out, err = cmd.CombinedOutput()
require.Error(t, err, string(out))
require.True(t, buildDetailsPattern.MatchString(string(out)), fmt.Sprintf("expected build details link in output, got %q", out))

Check failure on line 505 in tests/build.go

View workflow job for this annotation

GitHub Actions / test-integration (v0.14.1, remote, ./tests, experimental)

Failed: tests/TestIntegration/TestBuildDetailsLink/worker=remote

=== RUN TestIntegration/TestBuildDetailsLink/worker=remote === PAUSE TestIntegration/TestBuildDetailsLink/worker=remote === CONT TestIntegration/TestBuildDetailsLink/worker=remote build.go:505: Error Trace: /src/tests/build.go:505 /src/vendor/github.com/moby/buildkit/util/testutil/integration/run.go:97 /src/vendor/github.com/moby/buildkit/util/testutil/integration/run.go:211 Error: Should be true Test: TestIntegration/TestBuildDetailsLink/worker=remote Messages: expected build details link in output, got "#0 building with \"integration-remote-p4ej9a0lq4u0c1hwvu5gv99vn\" instance using remote driver\n\n#1 [internal] connecting to local controller\n#1 DONE 0.0s\n\n#2 [internal] load build definition from Dockerfile\n#2 transferring dockerfile: 67B done\n#2 DONE 0.0s\n\n#3 [internal] load metadata for docker.io/library/busybox:latest\n#3 DONE 0.0s\n\n#4 [internal] load .dockerignore\n#4 transferring context: 2B done\n#4 DONE 0.0s\n\n#5 [1/2] FROM docker.io/library/busybox:latest@sha256:023917ec6a886d0e8e15f28fb543515a5fcd8d938edb091e8147db4efed388ee\n#5 resolve docker.io/library/busybox:latest@sha256:023917ec6a886d0e8e15f28fb543515a5fcd8d938edb091e8147db4efed388ee done\n#5 CACHED\n\n#6 [2/2] RUN exit 1\n#6 ERROR: process \"/bin/sh -c exit 1\" did not complete successfully: exit code: 1\n------\n > [2/2] RUN exit 1:\n------\nDockerfile:2\n--------------------\n 1 | FROM busybox:latest\n 2 | >>> RUN exit 1\n--------------------\nERROR: process \"/bin/sh -c exit 1\" did not complete successfully: exit code: 1\n" sandbox.go:135: stdout: /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config1844897162/buildkitd.toml --root /tmp/bktest_buildkitd2884549963 --addr unix:///tmp/bktest_buildkitd2884549963/buildkitd.sock --debug sandbox.go:135: stderr: /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config1844897162/buildkitd.toml --root /tmp/bktest_buildkitd2884549963 --addr unix:///tmp/bktest_buildkitd2884549963/buildkitd.sock --debug sandbox.go:138: > StartCmd 2024-10-08 10:00:36.450785735 +0000 UTC m=+10.399923175 /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config1844897162/buildkitd.toml --root /tmp/bktest_buildkitd2884549963 --addr unix:///tmp/bktest_buildkitd2884549963/buildkitd.sock --debug sandbox.go:138: time="2024-10-08T10:00:36Z" level=warning msg="failed to get disk size: no such file or directory" sandbox.go:138: time="2024-10-08T10:00:36Z" level=warning msg="failed to get disk size: no such file or directory" sandbox.go:138: time="2024-10-08T10:00:36Z" level=info msg="auto snapshotter: using overlayfs" sandbox.go:138: time="2024-10-08T10:00:36Z" level=warning msg="using host network as the default" sandbox.go:138: time="2024-10-08T10:00:36Z" level=info msg="found worker \"azqsv3s7u4zvs3krgrydzovk2\", labels=map[org.mobyproject.buildkit.worker.executor:oci org.mobyproject.buildkit.worker.hostname:dd9ed8c010f5 org.mobyproject.buildkit.worker.network:host org.mobyproject.buildkit.worker.oci.process-mode:sandbox org.mobyproject.buildkit.worker.sandbox:true org.mobyproject.buildkit.worker.selinux.enabled:false org.mobyproject.buildkit.worker.snapshotter:overlayfs], platforms=[linux/amd64 linux/amd64/v2 linux/amd64/v3 linux/arm64 linux/riscv64 linux/ppc64le linux/s390x linux/386 linux/mips64le linux/mips64 linux/arm/v7 linux/arm/v6]" sandbox.go:138: time="2024-10-08T10:00:36Z" level=info msg="found 1 workers, default=\"azqsv3s7u4zvs3krgrydzovk2\"" sandbox.go:138: time="2024-10-08T10:00:36Z" level=warning msg="currently, only the default worker can be used." sandbox.go:138: time="2024-10-08T10:00:36Z" l

Check failure on line 505 in tests/build.go

View workflow job for this annotation

GitHub Actions / test-integration (buildx-stable-1, remote, ./tests, experimental)

Failed: tests/TestIntegration/TestBuildDetailsLink/worker=remote

=== RUN TestIntegration/TestBuildDetailsLink/worker=remote === PAUSE TestIntegration/TestBuildDetailsLink/worker=remote === CONT TestIntegration/TestBuildDetailsLink/worker=remote build.go:505: Error Trace: /src/tests/build.go:505 /src/vendor/github.com/moby/buildkit/util/testutil/integration/run.go:97 /src/vendor/github.com/moby/buildkit/util/testutil/integration/run.go:211 Error: Should be true Test: TestIntegration/TestBuildDetailsLink/worker=remote Messages: expected build details link in output, got "#0 building with \"integration-remote-jbgj2kcy97h8baj53oou949tn\" instance using remote driver\n\n#1 [internal] connecting to local controller\n#1 DONE 0.0s\n\n#2 [internal] load build definition from Dockerfile\n#2 transferring dockerfile: 67B done\n#2 DONE 0.0s\n\n#3 [internal] load metadata for docker.io/library/busybox:latest\n#3 DONE 0.0s\n\n#4 [internal] load .dockerignore\n#4 transferring context: 2B done\n#4 DONE 0.0s\n\n#5 [1/2] FROM docker.io/library/busybox:latest@sha256:023917ec6a886d0e8e15f28fb543515a5fcd8d938edb091e8147db4efed388ee\n#5 resolve docker.io/library/busybox:latest@sha256:023917ec6a886d0e8e15f28fb543515a5fcd8d938edb091e8147db4efed388ee done\n#5 CACHED\n\n#6 [2/2] RUN exit 1\n#6 ERROR: process \"/bin/sh -c exit 1\" did not complete successfully: exit code: 1\n------\n > [2/2] RUN exit 1:\n------\nDockerfile:2\n--------------------\n 1 | FROM busybox:latest\n 2 | >>> RUN exit 1\n--------------------\nERROR: process \"/bin/sh -c exit 1\" did not complete successfully: exit code: 1\n" sandbox.go:135: stdout: /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config4291976774/buildkitd.toml --root /tmp/bktest_buildkitd1787151986 --addr unix:///tmp/bktest_buildkitd1787151986/buildkitd.sock --debug sandbox.go:135: stderr: /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config4291976774/buildkitd.toml --root /tmp/bktest_buildkitd1787151986 --addr unix:///tmp/bktest_buildkitd1787151986/buildkitd.sock --debug sandbox.go:138: > StartCmd 2024-10-08 10:00:36.371479023 +0000 UTC m=+11.452962692 /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config4291976774/buildkitd.toml --root /tmp/bktest_buildkitd1787151986 --addr unix:///tmp/bktest_buildkitd1787151986/buildkitd.sock --debug sandbox.go:138: time="2024-10-08T10:00:36Z" level=warning msg="failed to get disk size: no such file or directory" sandbox.go:138: time="2024-10-08T10:00:36Z" level=warning msg="failed to get disk size: no such file or directory" sandbox.go:138: time="2024-10-08T10:00:36Z" level=info msg="auto snapshotter: using overlayfs" sandbox.go:138: time="2024-10-08T10:00:36Z" level=warning msg="using host network as the default" sandbox.go:138: time="2024-10-08T10:00:36Z" level=info msg="found worker \"s9zqmuxpb9b8w0gqcsum1a3fn\", labels=map[org.mobyproject.buildkit.worker.executor:oci org.mobyproject.buildkit.worker.hostname:c17da1bb7fc9 org.mobyproject.buildkit.worker.network:host org.mobyproject.buildkit.worker.oci.process-mode:sandbox org.mobyproject.buildkit.worker.sandbox:true org.mobyproject.buildkit.worker.selinux.enabled:false org.mobyproject.buildkit.worker.snapshotter:overlayfs], platforms=[linux/amd64 linux/amd64/v2 linux/amd64/v3 linux/arm64 linux/riscv64 linux/ppc64le linux/s390x linux/386 linux/mips64le linux/mips64 linux/arm/v7 linux/arm/v6]" sandbox.go:138: time="2024-10-08T10:00:36Z" level=info msg="found 1 workers, default=\"s9zqmuxpb9b8w0gqcsum1a3fn\"" sandbox.go:138: time="2024-10-08T10:00:36Z" level=warning msg="currently, only the default worker can be used." sandbox.go:138: time="2024-10-08T10:00:36Z" l

Check failure on line 505 in tests/build.go

View workflow job for this annotation

GitHub Actions / test-integration (latest, remote, ./tests, experimental)

Failed: tests/TestIntegration/TestBuildDetailsLink/worker=remote

=== RUN TestIntegration/TestBuildDetailsLink/worker=remote === PAUSE TestIntegration/TestBuildDetailsLink/worker=remote === CONT TestIntegration/TestBuildDetailsLink/worker=remote build.go:505: Error Trace: /src/tests/build.go:505 /src/vendor/github.com/moby/buildkit/util/testutil/integration/run.go:97 /src/vendor/github.com/moby/buildkit/util/testutil/integration/run.go:211 Error: Should be true Test: TestIntegration/TestBuildDetailsLink/worker=remote Messages: expected build details link in output, got "#0 building with \"integration-remote-kfbo9im5qvphcy5weoikgrvwg\" instance using remote driver\n\n#1 [internal] connecting to local controller\n#1 DONE 0.0s\n\n#2 [internal] load build definition from Dockerfile\n#2 transferring dockerfile: 67B done\n#2 DONE 0.0s\n\n#3 [internal] load metadata for docker.io/library/busybox:latest\n#3 DONE 0.0s\n\n#4 [internal] load .dockerignore\n#4 transferring context: 2B done\n#4 DONE 0.0s\n\n#5 [1/2] FROM docker.io/library/busybox:latest@sha256:023917ec6a886d0e8e15f28fb543515a5fcd8d938edb091e8147db4efed388ee\n#5 resolve docker.io/library/busybox:latest@sha256:023917ec6a886d0e8e15f28fb543515a5fcd8d938edb091e8147db4efed388ee done\n#5 CACHED\n\n#6 [2/2] RUN exit 1\n#6 ERROR: process \"/bin/sh -c exit 1\" did not complete successfully: exit code: 1\n------\n > [2/2] RUN exit 1:\n------\nDockerfile:2\n--------------------\n 1 | FROM busybox:latest\n 2 | >>> RUN exit 1\n--------------------\nERROR: process \"/bin/sh -c exit 1\" did not complete successfully: exit code: 1\n" sandbox.go:135: stdout: /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config905059333/buildkitd.toml --root /tmp/bktest_buildkitd3887428987 --addr unix:///tmp/bktest_buildkitd3887428987/buildkitd.sock --debug sandbox.go:135: stderr: /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config905059333/buildkitd.toml --root /tmp/bktest_buildkitd3887428987 --addr unix:///tmp/bktest_buildkitd3887428987/buildkitd.sock --debug sandbox.go:138: > StartCmd 2024-10-08 10:00:41.697612897 +0000 UTC m=+11.646924346 /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config905059333/buildkitd.toml --root /tmp/bktest_buildkitd3887428987 --addr unix:///tmp/bktest_buildkitd3887428987/buildkitd.sock --debug sandbox.go:138: time="2024-10-08T10:00:41Z" level=warning msg="failed to get disk size: no such file or directory" sandbox.go:138: time="2024-10-08T10:00:41Z" level=warning msg="failed to get disk size: no such file or directory" sandbox.go:138: time="2024-10-08T10:00:41Z" level=info msg="auto snapshotter: using overlayfs" sandbox.go:138: time="2024-10-08T10:00:41Z" level=warning msg="using host network as the default" sandbox.go:138: time="2024-10-08T10:00:41Z" level=info msg="found worker \"wemjw365sq8g3xcz1u8qbc3zk\", labels=map[org.mobyproject.buildkit.worker.executor:oci org.mobyproject.buildkit.worker.hostname:7f985c13f154 org.mobyproject.buildkit.worker.network:host org.mobyproject.buildkit.worker.oci.process-mode:sandbox org.mobyproject.buildkit.worker.sandbox:true org.mobyproject.buildkit.worker.selinux.enabled:false org.mobyproject.buildkit.worker.snapshotter:overlayfs], platforms=[linux/amd64 linux/amd64/v2 linux/amd64/v3 linux/arm64 linux/riscv64 linux/ppc64le linux/s390x linux/386 linux/mips64le linux/mips64 linux/arm/v7 linux/arm/v6]" sandbox.go:138: time="2024-10-08T10:00:41Z" level=info msg="found 1 workers, default=\"wemjw365sq8g3xcz1u8qbc3zk\"" sandbox.go:138: time="2024-10-08T10:00:41Z" level=warning msg="currently, only the default worker can be used." sandbox.go:138: time="2024-10-08T10:00:41Z" leve

Check failure on line 505 in tests/build.go

View workflow job for this annotation

GitHub Actions / test-integration (master, remote, ./tests, experimental)

Failed: tests/TestIntegration/TestBuildDetailsLink/worker=remote

=== RUN TestIntegration/TestBuildDetailsLink/worker=remote === PAUSE TestIntegration/TestBuildDetailsLink/worker=remote === CONT TestIntegration/TestBuildDetailsLink/worker=remote build.go:505: Error Trace: /src/tests/build.go:505 /src/vendor/github.com/moby/buildkit/util/testutil/integration/run.go:97 /src/vendor/github.com/moby/buildkit/util/testutil/integration/run.go:211 Error: Should be true Test: TestIntegration/TestBuildDetailsLink/worker=remote Messages: expected build details link in output, got "#0 building with \"integration-remote-k37l02npab5leh95amgd9uw67\" instance using remote driver\n\n#1 [internal] connecting to local controller\n#1 DONE 0.0s\n\n#2 [internal] load build definition from Dockerfile\n#2 transferring dockerfile: 67B done\n#2 DONE 0.0s\n\n#3 [internal] load metadata for docker.io/library/busybox:latest\n#3 DONE 0.0s\n\n#4 [internal] load .dockerignore\n#4 transferring context: 2B done\n#4 DONE 0.0s\n\n#5 [1/2] FROM docker.io/library/busybox:latest@sha256:023917ec6a886d0e8e15f28fb543515a5fcd8d938edb091e8147db4efed388ee\n#5 resolve docker.io/library/busybox:latest@sha256:023917ec6a886d0e8e15f28fb543515a5fcd8d938edb091e8147db4efed388ee done\n#5 CACHED\n\n#6 [2/2] RUN exit 1\n#6 ERROR: process \"/bin/sh -c exit 1\" did not complete successfully: exit code: 1\n------\n > [2/2] RUN exit 1:\n------\nDockerfile:2\n--------------------\n 1 | FROM busybox:latest\n 2 | >>> RUN exit 1\n--------------------\nERROR: process \"/bin/sh -c exit 1\" did not complete successfully: exit code: 1\n" sandbox.go:135: stdout: /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config271193343/buildkitd.toml --root /tmp/bktest_buildkitd2038744703 --addr unix:///tmp/bktest_buildkitd2038744703/buildkitd.sock --debug sandbox.go:135: stderr: /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config271193343/buildkitd.toml --root /tmp/bktest_buildkitd2038744703 --addr unix:///tmp/bktest_buildkitd2038744703/buildkitd.sock --debug sandbox.go:138: > StartCmd 2024-10-08 10:00:45.097302311 +0000 UTC m=+12.834971491 /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config271193343/buildkitd.toml --root /tmp/bktest_buildkitd2038744703 --addr unix:///tmp/bktest_buildkitd2038744703/buildkitd.sock --debug sandbox.go:138: time="2024-10-08T10:00:45Z" level=warning msg="failed to get disk size: no such file or directory" sandbox.go:138: time="2024-10-08T10:00:45Z" level=warning msg="failed to get disk size: no such file or directory" sandbox.go:138: time="2024-10-08T10:00:45Z" level=info msg="auto snapshotter: using overlayfs" sandbox.go:138: time="2024-10-08T10:00:45Z" level=warning msg="using host network as the default" sandbox.go:138: time="2024-10-08T10:00:45Z" level=info msg="found worker \"6hcrtrhqodlzthvmqm6qd2uu6\", labels=map[org.mobyproject.buildkit.worker.executor:oci org.mobyproject.buildkit.worker.hostname:8dbfd92ff47a org.mobyproject.buildkit.worker.network:host org.mobyproject.buildkit.worker.oci.process-mode:sandbox org.mobyproject.buildkit.worker.sandbox:true org.mobyproject.buildkit.worker.selinux.enabled:false org.mobyproject.buildkit.worker.snapshotter:overlayfs], platforms=[linux/amd64 linux/amd64/v2 linux/amd64/v3 linux/arm64 linux/riscv64 linux/ppc64le linux/s390x linux/386 linux/arm/v7 linux/arm/v6]" sandbox.go:138: time="2024-10-08T10:00:45Z" level=info msg="found 1 workers, default=\"6hcrtrhqodlzthvmqm6qd2uu6\"" sandbox.go:138: time="2024-10-08T10:00:45Z" level=warning msg="currently, only the default worker can be used." sandbox.go:138: time="2024-10-08T10:00:45Z" level=info msg="running server o

Check failure on line 505 in tests/build.go

View workflow job for this annotation

GitHub Actions / test-integration (v0.15.2, remote, ./tests, experimental)

Failed: tests/TestIntegration/TestBuildDetailsLink/worker=remote

=== RUN TestIntegration/TestBuildDetailsLink/worker=remote === PAUSE TestIntegration/TestBuildDetailsLink/worker=remote === CONT TestIntegration/TestBuildDetailsLink/worker=remote build.go:505: Error Trace: /src/tests/build.go:505 /src/vendor/github.com/moby/buildkit/util/testutil/integration/run.go:97 /src/vendor/github.com/moby/buildkit/util/testutil/integration/run.go:211 Error: Should be true Test: TestIntegration/TestBuildDetailsLink/worker=remote Messages: expected build details link in output, got "#0 building with \"integration-remote-i7dwcb0l7oq3byqwmh4hwwnmc\" instance using remote driver\n\n#1 [internal] connecting to local controller\n#1 DONE 0.0s\n\n#2 [internal] load build definition from Dockerfile\n#2 transferring dockerfile: 67B done\n#2 DONE 0.0s\n\n#3 [internal] load metadata for docker.io/library/busybox:latest\n#3 DONE 0.0s\n\n#4 [internal] load .dockerignore\n#4 transferring context: 2B done\n#4 DONE 0.0s\n\n#5 [1/2] FROM docker.io/library/busybox:latest@sha256:023917ec6a886d0e8e15f28fb543515a5fcd8d938edb091e8147db4efed388ee\n#5 resolve docker.io/library/busybox:latest@sha256:023917ec6a886d0e8e15f28fb543515a5fcd8d938edb091e8147db4efed388ee done\n#5 CACHED\n\n#6 [2/2] RUN exit 1\n#6 ERROR: process \"/bin/sh -c exit 1\" did not complete successfully: exit code: 1\n------\n > [2/2] RUN exit 1:\n------\nDockerfile:2\n--------------------\n 1 | FROM busybox:latest\n 2 | >>> RUN exit 1\n--------------------\nERROR: process \"/bin/sh -c exit 1\" did not complete successfully: exit code: 1\n" sandbox.go:135: stdout: /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config2686995868/buildkitd.toml --root /tmp/bktest_buildkitd3895697336 --addr unix:///tmp/bktest_buildkitd3895697336/buildkitd.sock --debug sandbox.go:135: stderr: /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config2686995868/buildkitd.toml --root /tmp/bktest_buildkitd3895697336 --addr unix:///tmp/bktest_buildkitd3895697336/buildkitd.sock --debug sandbox.go:138: > StartCmd 2024-10-08 10:00:48.23342391 +0000 UTC m=+12.758211971 /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config2686995868/buildkitd.toml --root /tmp/bktest_buildkitd3895697336 --addr unix:///tmp/bktest_buildkitd3895697336/buildkitd.sock --debug sandbox.go:138: time="2024-10-08T10:00:48Z" level=warning msg="failed to get disk size: no such file or directory" sandbox.go:138: time="2024-10-08T10:00:48Z" level=warning msg="failed to get disk size: no such file or directory" sandbox.go:138: time="2024-10-08T10:00:48Z" level=info msg="auto snapshotter: using overlayfs" sandbox.go:138: time="2024-10-08T10:00:48Z" level=warning msg="using host network as the default" sandbox.go:138: time="2024-10-08T10:00:48Z" level=info msg="found worker \"o9o89602ecj8r2cj2zmpbc2q4\", labels=map[org.mobyproject.buildkit.worker.executor:oci org.mobyproject.buildkit.worker.hostname:acb8c39bcc22 org.mobyproject.buildkit.worker.network:host org.mobyproject.buildkit.worker.oci.process-mode:sandbox org.mobyproject.buildkit.worker.sandbox:true org.mobyproject.buildkit.worker.selinux.enabled:false org.mobyproject.buildkit.worker.snapshotter:overlayfs], platforms=[linux/amd64 linux/amd64/v2 linux/amd64/v3 linux/arm64 linux/riscv64 linux/ppc64le linux/s390x linux/386 linux/mips64le linux/mips64 linux/arm/v7 linux/arm/v6]" sandbox.go:138: time="2024-10-08T10:00:48Z" level=info msg="found 1 workers, default=\"o9o89602ecj8r2cj2zmpbc2q4\"" sandbox.go:138: time="2024-10-08T10:00:48Z" level=warning msg="currently, only the default worker can be used." sandbox.go:138: time="2024-10-08T10:00:48Z" le

Check failure on line 505 in tests/build.go

View workflow job for this annotation

GitHub Actions / test-integration (v0.13.2, remote, ./tests, experimental)

Failed: tests/TestIntegration/TestBuildDetailsLink/worker=remote

=== RUN TestIntegration/TestBuildDetailsLink/worker=remote === PAUSE TestIntegration/TestBuildDetailsLink/worker=remote === CONT TestIntegration/TestBuildDetailsLink/worker=remote build.go:505: Error Trace: /src/tests/build.go:505 /src/vendor/github.com/moby/buildkit/util/testutil/integration/run.go:97 /src/vendor/github.com/moby/buildkit/util/testutil/integration/run.go:211 Error: Should be true Test: TestIntegration/TestBuildDetailsLink/worker=remote Messages: expected build details link in output, got "#0 building with \"integration-remote-2m2izn5xhxdz3g0gi1popjl30\" instance using remote driver\n\n#1 [internal] connecting to local controller\n#1 DONE 0.0s\n\n#2 [internal] load build definition from Dockerfile\n#2 transferring dockerfile: 67B done\n#2 DONE 0.0s\n\n#3 [internal] load metadata for docker.io/library/busybox:latest\n#3 DONE 0.0s\n\n#4 [internal] load .dockerignore\n#4 transferring context: 2B done\n#4 DONE 0.0s\n\n#5 [1/2] FROM docker.io/library/busybox:latest@sha256:023917ec6a886d0e8e15f28fb543515a5fcd8d938edb091e8147db4efed388ee\n#5 resolve docker.io/library/busybox:latest@sha256:023917ec6a886d0e8e15f28fb543515a5fcd8d938edb091e8147db4efed388ee done\n#5 CACHED\n\n#6 [2/2] RUN exit 1\n#6 ERROR: process \"/bin/sh -c exit 1\" did not complete successfully: exit code: 1\n------\n > [2/2] RUN exit 1:\n------\nDockerfile:2\n--------------------\n 1 | FROM busybox:latest\n 2 | >>> RUN exit 1\n--------------------\nERROR: process \"/bin/sh -c exit 1\" did not complete successfully: exit code: 1\n" sandbox.go:135: stdout: /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config1225135387/buildkitd.toml --root /tmp/bktest_buildkitd12228967 --addr unix:///tmp/bktest_buildkitd12228967/buildkitd.sock --debug sandbox.go:135: stderr: /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config1225135387/buildkitd.toml --root /tmp/bktest_buildkitd12228967 --addr unix:///tmp/bktest_buildkitd12228967/buildkitd.sock --debug sandbox.go:138: > StartCmd 2024-10-08 10:00:58.988860817 +0000 UTC m=+19.816712003 /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config1225135387/buildkitd.toml --root /tmp/bktest_buildkitd12228967 --addr unix:///tmp/bktest_buildkitd12228967/buildkitd.sock --debug sandbox.go:138: time="2024-10-08T10:00:59Z" level=warning msg="failed to get disk size: no such file or directory" sandbox.go:138: time="2024-10-08T10:00:59Z" level=warning msg="failed to get disk size: no such file or directory" sandbox.go:138: time="2024-10-08T10:00:59Z" level=info msg="auto snapshotter: using overlayfs" sandbox.go:138: time="2024-10-08T10:00:59Z" level=warning msg="using host network as the default" sandbox.go:138: time="2024-10-08T10:00:59Z" level=info msg="found worker \"wytz0eb70t7qhak89ac1x3muc\", labels=map[org.mobyproject.buildkit.worker.executor:oci org.mobyproject.buildkit.worker.hostname:a96299d147a2 org.mobyproject.buildkit.worker.network:host org.mobyproject.buildkit.worker.oci.process-mode:sandbox org.mobyproject.buildkit.worker.sandbox:true org.mobyproject.buildkit.worker.selinux.enabled:false org.mobyproject.buildkit.worker.snapshotter:overlayfs], platforms=[linux/amd64 linux/amd64/v2 linux/amd64/v3 linux/arm64 linux/riscv64 linux/ppc64le linux/s390x linux/386 linux/mips64le linux/mips64 linux/arm/v7 linux/arm/v6]" sandbox.go:138: time="2024-10-08T10:00:59Z" level=info msg="found 1 workers, default=\"wytz0eb70t7qhak89ac1x3muc\"" sandbox.go:138: time="2024-10-08T10:00:59Z" level=warning msg="currently, only the default worker can be used." sandbox.go:138: time="2024-10-08T10:00:59Z" level=info ms
Expand Down
12 changes: 11 additions & 1 deletion tests/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ func buildxCmd(sb integration.Sandbox, opts ...cmdOpt) *exec.Cmd {
)
}
if context := sb.DockerAddress(); context != "" {
cmd.Env = append(cmd.Env, "DOCKER_CONTEXT="+context)
cmd.Env = append(cmd.Env,
"DOCKER_CONFIG="+dockerConfig(sb),
"DOCKER_CONTEXT="+context,
)
}
if isExperimental() {
cmd.Env = append(cmd.Env, "BUILDX_EXPERIMENTAL=1")
Expand Down Expand Up @@ -94,6 +97,13 @@ func buildxConfig(sb integration.Sandbox) string {
return ""
}

func dockerConfig(sb integration.Sandbox) string {
if context := sb.DockerAddress(); context != "" {
return "/tmp/docker-" + context
}
return ""
}

func isMobyWorker(sb integration.Sandbox) bool {
name, hasFeature := driverName(sb.Name())
return name == "docker" && !hasFeature
Expand Down

0 comments on commit 052caaa

Please sign in to comment.