From a3286a0ab169ba4d0e0cf9d263bbdb7ce1d38c45 Mon Sep 17 00:00:00 2001 From: David Karlsson Date: Wed, 1 Feb 2023 21:19:34 +0100 Subject: [PATCH 1/2] docs: added --platform=local example Signed-off-by: David Karlsson --- docs/reference/buildx_build.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/reference/buildx_build.md b/docs/reference/buildx_build.md index 60ea921a..5f77c92f 100644 --- a/docs/reference/buildx_build.md +++ b/docs/reference/buildx_build.md @@ -414,8 +414,13 @@ The `registry` exporter is a shortcut for `type=image,push=true`. Set the target platform for the build. All `FROM` commands inside the Dockerfile without their own `--platform` flag will pull base images for this platform and -this value will also be the platform of the resulting image. The default value -will be the current platform of the buildkit daemon. +this value will also be the platform of the resulting image. + +The default value is the platform of the BuildKit daemon where the build runs. +The value takes the form of `os/arch` or `os/arch/variant`. For example, +`linux/amd64` or `linux/arm/v7`. Additionally, the `--platform` flag also supports +a special `local` value, which tells BuildKit to use the platform of the BuildKit +client that invokes the build. When using `docker-container` driver with `buildx`, this flag can accept multiple values as an input separated by a comma. With multiple values the result will be From b1440b07f233240def128bfc7655189bef6300c7 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 24 Feb 2023 13:18:23 +0100 Subject: [PATCH 2/2] build: makes git dirty check opt-in Signed-off-by: CrazyMax --- build/git.go | 8 +++++++- build/git_test.go | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/build/git.go b/build/git.go index e7b5d8eb..d80a00ba 100644 --- a/build/git.go +++ b/build/git.go @@ -67,7 +67,13 @@ func getGitAttributes(ctx context.Context, contextPath string, dockerfilePath st if sha, err := gitc.FullCommit(); err != nil && !gitutil.IsUnknownRevision(err) { return res, errors.Wrapf(err, "buildx: failed to get git commit") } else if sha != "" { - if gitc.IsDirty() { + checkDirty := false + if v, ok := os.LookupEnv("BUILDX_GIT_CHECK_DIRTY"); ok { + if v, err := strconv.ParseBool(v); err == nil { + checkDirty = v + } + } + if checkDirty && gitc.IsDirty() { sha += "-dirty" } if setGitLabels { diff --git a/build/git_test.go b/build/git_test.go index 18d995b0..5d65b64b 100644 --- a/build/git_test.go +++ b/build/git_test.go @@ -131,6 +131,7 @@ func TestGetGitAttributes(t *testing.T) { func TestGetGitAttributesDirty(t *testing.T) { setupTest(t) + t.Setenv("BUILDX_GIT_CHECK_DIRTY", "true") // make a change to test dirty flag df := []byte("FROM alpine:edge\n")