Skip to content

Commit 5ac3b4c

Browse files
authored
Merge pull request #1662 from crazy-max/v0.10.4_picks
[v0.10] cherry-picks for v0.10.4
2 parents b79345c + b1440b0 commit 5ac3b4c

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

build/git.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,13 @@ func getGitAttributes(ctx context.Context, contextPath string, dockerfilePath st
6767
if sha, err := gitc.FullCommit(); err != nil && !gitutil.IsUnknownRevision(err) {
6868
return res, errors.Wrapf(err, "buildx: failed to get git commit")
6969
} else if sha != "" {
70-
if gitc.IsDirty() {
70+
checkDirty := false
71+
if v, ok := os.LookupEnv("BUILDX_GIT_CHECK_DIRTY"); ok {
72+
if v, err := strconv.ParseBool(v); err == nil {
73+
checkDirty = v
74+
}
75+
}
76+
if checkDirty && gitc.IsDirty() {
7177
sha += "-dirty"
7278
}
7379
if setGitLabels {

build/git_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ func TestGetGitAttributes(t *testing.T) {
131131

132132
func TestGetGitAttributesDirty(t *testing.T) {
133133
setupTest(t)
134+
t.Setenv("BUILDX_GIT_CHECK_DIRTY", "true")
134135

135136
// make a change to test dirty flag
136137
df := []byte("FROM alpine:edge\n")

docs/reference/buildx_build.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,13 @@ The `registry` exporter is a shortcut for `type=image,push=true`.
414414

415415
Set the target platform for the build. All `FROM` commands inside the Dockerfile
416416
without their own `--platform` flag will pull base images for this platform and
417-
this value will also be the platform of the resulting image. The default value
418-
will be the current platform of the buildkit daemon.
417+
this value will also be the platform of the resulting image.
418+
419+
The default value is the platform of the BuildKit daemon where the build runs.
420+
The value takes the form of `os/arch` or `os/arch/variant`. For example,
421+
`linux/amd64` or `linux/arm/v7`. Additionally, the `--platform` flag also supports
422+
a special `local` value, which tells BuildKit to use the platform of the BuildKit
423+
client that invokes the build.
419424

420425
When using `docker-container` driver with `buildx`, this flag can accept multiple
421426
values as an input separated by a comma. With multiple values the result will be

0 commit comments

Comments
 (0)