Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/opt.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ func toSolveOpt(ctx context.Context, np *noderesolver.ResolvedNode, multiDriver
if len(opt.Platforms) != 0 {
pp := make([]string, len(opt.Platforms))
for i, p := range opt.Platforms {
pp[i] = platforms.Format(p)
pp[i] = platforms.FormatAll(p)
}
if len(pp) > 1 && !nodeDriver.Features(ctx)[driver.MultiPlatform] {
return nil, nil, notSupported(driver.MultiPlatform, nodeDriver, "https://docs.docker.com/go/build-multi-platform/")
Expand Down
18 changes: 18 additions & 0 deletions tests/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ var buildTests = []func(t *testing.T, sb integration.Sandbox){
testBuildCacheExportNotSupported,
testBuildOCIExportNotSupported,
testBuildMultiPlatform,
testBuildTargetPlatformOSVersion,
testDockerHostGateway,
testBuildNetworkModeBridge,
testBuildShmSize,
Expand Down Expand Up @@ -1006,6 +1007,23 @@ func testBuildMultiPlatform(t *testing.T, sb integration.Sandbox) {
}
}

func testBuildTargetPlatformOSVersion(t *testing.T, sb integration.Sandbox) {
skipNoCompatBuildKit(t, sb, ">= 0.19.0-0", "platform OS version")
integration.SkipOnPlatform(t, "windows")

dockerfile := []byte(`
FROM --platform=$BUILDPLATFORM busybox:latest
ARG TARGETPLATFORM
ARG TARGETOSVERSION
RUN test "$TARGETPLATFORM" = "windows(10.0.17763)/amd64"
RUN test "$TARGETOSVERSION" = "10.0.17763"
`)
dir := tmpdir(t, fstest.CreateFile("Dockerfile", dockerfile, 0o600))

out, err := buildCmd(sb, withArgs("--platform=windows(10.0.17763)/amd64", "--output=type=cacheonly", dir))
require.NoError(t, err, string(out))
}

func testDockerHostGateway(t *testing.T, sb integration.Sandbox) {
dockerfile := []byte(`
FROM busybox
Expand Down
Loading