From 2ac345fd33678a46bd4e9d2c848e7122aeac1bce Mon Sep 17 00:00:00 2001 From: Brad Davidson Date: Tue, 11 Aug 2026 00:32:44 +0000 Subject: [PATCH 1/2] Do not drop OS version when constructing build options Signed-off-by: Brad Davidson --- build/opt.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/opt.go b/build/opt.go index a4535e679ac1..3919bd9681e7 100644 --- a/build/opt.go +++ b/build/opt.go @@ -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/") From 0ea630200b54db15b5c7b912c274c300df5efca2 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Tue, 11 Aug 2026 15:31:34 +0200 Subject: [PATCH 2/2] test: integration coverage for OS version platforms Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- tests/build.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/build.go b/tests/build.go index 63fec7d1fd5b..1b8c7a2504e3 100644 --- a/tests/build.go +++ b/tests/build.go @@ -78,6 +78,7 @@ var buildTests = []func(t *testing.T, sb integration.Sandbox){ testBuildCacheExportNotSupported, testBuildOCIExportNotSupported, testBuildMultiPlatform, + testBuildTargetPlatformOSVersion, testDockerHostGateway, testBuildNetworkModeBridge, testBuildShmSize, @@ -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