From 944fd444f6e6f2585becefeb0d7eba009ca5b4f8 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 27 Aug 2021 09:48:31 +0200 Subject: [PATCH 1/2] container-driver: fix volume destination for cache The container-driver creates a Linux container (as there currently isn't a Windows version of buildkitd). However, the defaults are platform specific. Buildx was using the defaults from the buildkit `util/appdefault' package, which resulted in Buildx running on a Windows client to create a Linux container that used the Windows location, which causes it to fail: invalid mount config for type "volume": invalid mount path: 'C:/ProgramData/buildkitd/.buildstate' mount path must be absolute This patch hard-codes the destination to the default Linux path. Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 93867d02f0a989f084e54d7133371f583a4d3c5e) --- driver/docker-container/driver.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/driver/docker-container/driver.go b/driver/docker-container/driver.go index d240b04a..6274bb0e 100644 --- a/driver/docker-container/driver.go +++ b/driver/docker-container/driver.go @@ -22,12 +22,19 @@ import ( dockerclient "github.com/docker/docker/client" "github.com/docker/docker/pkg/stdcopy" "github.com/moby/buildkit/client" - "github.com/moby/buildkit/util/appdefaults" "github.com/moby/buildkit/util/tracing/detect" "github.com/pkg/errors" ) -const volumeStateSuffix = "_state" +const ( + volumeStateSuffix = "_state" + + // containerStateDir is the location where buildkitd inside the container + // stores its state. The container driver creates a Linux container, so + // this should match the location for Linux, as defined in: + // https://github.com/moby/buildkit/blob/v0.9.0/util/appdefaults/appdefaults_unix.go#L11-L15 + containerBuildKitRootDir = "/var/lib/buildkit" +) type Driver struct { driver.InitConfig @@ -111,7 +118,7 @@ func (d *Driver) create(ctx context.Context, l progress.SubLogger) error { { Type: mount.TypeVolume, Source: d.Name + volumeStateSuffix, - Target: appdefaults.Root, + Target: containerBuildKitRootDir, }, }, } From 0b320faf348043f4c8f99aa212301b8e52e1c201 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Fri, 27 Aug 2021 21:10:13 -0700 Subject: [PATCH 2/2] github: fix running ci in version branches Signed-off-by: Tonis Tiigi (cherry picked from commit 9833420a03705919c483a240800ca41c16a1441c) --- .github/workflows/build.yml | 2 ++ .github/workflows/validate.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 79d85a6f..eedf61f6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,11 +5,13 @@ on: push: branches: - 'master' + - 'v[0-9]*' tags: - 'v*' pull_request: branches: - 'master' + - 'v[0-9]*' env: REPO_SLUG: "docker/buildx-bin" diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 02de4cd4..53e0774f 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -5,11 +5,13 @@ on: push: branches: - 'master' + - 'v[0-9]*' tags: - 'v*' pull_request: branches: - 'master' + - 'v[0-9]*' env: REPO_SLUG_ORIGIN: "moby/buildkit:master"