@@ -1356,13 +1356,18 @@ RUN [ "$(stat -c "%U %G" /dest01)" == "user01 user" ]
1356
1356
}
1357
1357
1358
1358
func testCopyThroughSymlinkContext (t * testing.T , sb integration.Sandbox ) {
1359
- integration .SkipOnPlatform (t , "windows" )
1360
1359
f := getFrontend (t , sb )
1361
1360
1362
- dockerfile := []byte (`
1361
+ dockerfile := []byte (integration .UnixOrWindows (
1362
+ `
1363
1363
FROM scratch
1364
1364
COPY link/foo .
1365
- ` )
1365
+ ` ,
1366
+ `
1367
+ FROM nanoserver AS build
1368
+ COPY link/foo .
1369
+ ` ,
1370
+ ))
1366
1371
1367
1372
dir := integration .Tmpdir (
1368
1373
t ,
@@ -1481,14 +1486,20 @@ COPY . /
1481
1486
}
1482
1487
1483
1488
func testIgnoreEntrypoint (t * testing.T , sb integration.Sandbox ) {
1484
- integration .SkipOnPlatform (t , "windows" )
1485
1489
f := getFrontend (t , sb )
1486
1490
1487
- dockerfile := []byte (`
1491
+ dockerfile := []byte (integration .UnixOrWindows (
1492
+ `
1488
1493
FROM busybox
1489
1494
ENTRYPOINT ["/nosuchcmd"]
1490
1495
RUN ["ls"]
1491
- ` )
1496
+ ` ,
1497
+ `
1498
+ FROM nanoserver AS build
1499
+ ENTRYPOINT ["nosuchcmd.exe"]
1500
+ RUN dir
1501
+ ` ,
1502
+ ))
1492
1503
1493
1504
dir := integration .Tmpdir (
1494
1505
t ,
@@ -1509,10 +1520,10 @@ RUN ["ls"]
1509
1520
}
1510
1521
1511
1522
func testQuotedMetaArgs (t * testing.T , sb integration.Sandbox ) {
1512
- integration .SkipOnPlatform (t , "windows" )
1513
1523
f := getFrontend (t , sb )
1514
1524
1515
- dockerfile := []byte (`
1525
+ dockerfile := []byte (integration .UnixOrWindows (
1526
+ `
1516
1527
ARG a1="box"
1517
1528
ARG a2="$a1-foo"
1518
1529
FROM busy$a1 AS build
@@ -1521,7 +1532,19 @@ ARG a3="bar-$a2"
1521
1532
RUN echo -n $a3 > /out
1522
1533
FROM scratch
1523
1534
COPY --from=build /out .
1524
- ` )
1535
+ ` ,
1536
+ `
1537
+ ARG a1="server"
1538
+ ARG a2="$a1-foo"
1539
+ FROM nano$a1 AS build
1540
+ USER ContainerAdministrator
1541
+ ARG a2
1542
+ ARG a3="bar-$a2"
1543
+ RUN echo %a3% > /out
1544
+ FROM nanoserver
1545
+ COPY --from=build /out .
1546
+ ` ,
1547
+ ))
1525
1548
1526
1549
dir := integration .Tmpdir (
1527
1550
t ,
@@ -1550,7 +1573,10 @@ COPY --from=build /out .
1550
1573
1551
1574
dt , err := os .ReadFile (filepath .Join (destDir , "out" ))
1552
1575
require .NoError (t , err )
1553
- require .Equal (t , "bar-box-foo" , string (dt ))
1576
+
1577
+ testString := string ([]byte (integration .UnixOrWindows ("bar-box-foo" , "bar-server-foo \r \n " )))
1578
+
1579
+ require .Equal (t , testString , string (dt ))
1554
1580
}
1555
1581
1556
1582
func testGlobalArgErrors (t * testing.T , sb integration.Sandbox ) {
@@ -6312,14 +6338,19 @@ COPY Dockerfile Dockerfile
6312
6338
6313
6339
// moby/buildkit#1301
6314
6340
func testDockerfileCheckHostname (t * testing.T , sb integration.Sandbox ) {
6315
- integration .SkipOnPlatform (t , "windows" )
6316
6341
f := getFrontend (t , sb )
6317
- dockerfile := []byte (`
6342
+ dockerfile := []byte (integration .UnixOrWindows (
6343
+ `
6318
6344
FROM busybox
6319
6345
RUN cat /etc/hosts | grep foo
6320
6346
RUN echo $HOSTNAME | grep foo
6321
6347
RUN echo $(hostname) | grep foo
6322
- ` )
6348
+ ` ,
6349
+ `
6350
+ FROM nanoserver
6351
+ RUN reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname | findstr "foo"
6352
+ ` ,
6353
+ ))
6323
6354
6324
6355
dir := integration .Tmpdir (
6325
6356
t ,
@@ -6370,11 +6401,8 @@ RUN echo $(hostname) | grep foo
6370
6401
}
6371
6402
6372
6403
func testEmptyStages (t * testing.T , sb integration.Sandbox ) {
6373
- integration .SkipOnPlatform (t , "windows" )
6374
6404
f := getFrontend (t , sb )
6375
- dockerfile := []byte (`
6376
- ARG foo=bar
6377
- ` )
6405
+ dockerfile := []byte (`ARG foo=bar` )
6378
6406
6379
6407
dir := integration .Tmpdir (
6380
6408
t ,
@@ -6693,7 +6721,6 @@ COPY --from=base /env_foobar /
6693
6721
}
6694
6722
6695
6723
func testNamedImageContextPlatform (t * testing.T , sb integration.Sandbox ) {
6696
- integration .SkipOnPlatform (t , "windows" )
6697
6724
workers .CheckFeatureCompat (t , sb , workers .FeatureDirectPush )
6698
6725
ctx := sb .Context ()
6699
6726
@@ -6708,7 +6735,13 @@ func testNamedImageContextPlatform(t *testing.T, sb integration.Sandbox) {
6708
6735
require .NoError (t , err )
6709
6736
6710
6737
// Build a base image and force buildkit to generate a manifest list.
6711
- dockerfile := []byte (`FROM --platform=$BUILDPLATFORM alpine:latest` )
6738
+ baseImage := integration .UnixOrWindows (
6739
+ "alpine" ,
6740
+ "nanoserver" ,
6741
+ )
6742
+
6743
+ dockerfile := []byte (fmt .Sprintf (`FROM --platform=$BUILDPLATFORM %s:latest` , baseImage ))
6744
+
6712
6745
target := registry + "/buildkit/testnamedimagecontextplatform:latest"
6713
6746
6714
6747
dir := integration .Tmpdir (
@@ -6738,10 +6771,10 @@ func testNamedImageContextPlatform(t *testing.T, sb integration.Sandbox) {
6738
6771
}, nil )
6739
6772
require .NoError (t , err )
6740
6773
6741
- dockerfile = []byte (`
6742
- FROM --platform=$BUILDPLATFORM busybox AS target
6743
- RUN echo hello
6744
- ` )
6774
+ dockerfile = []byte (fmt . Sprintf ( `
6775
+ FROM --platform=$BUILDPLATFORM %s AS target
6776
+ RUN echo hello
6777
+ ` , baseImage ) )
6745
6778
6746
6779
dir = integration .Tmpdir (
6747
6780
t ,
@@ -6852,19 +6885,20 @@ RUN echo foo >> /test
6852
6885
}
6853
6886
6854
6887
func testNamedImageContextScratch (t * testing.T , sb integration.Sandbox ) {
6855
- integration .SkipOnPlatform (t , "windows" )
6856
6888
ctx := sb .Context ()
6857
6889
6858
6890
c , err := client .New (ctx , sb .Address ())
6859
6891
require .NoError (t , err )
6860
6892
defer c .Close ()
6861
6893
6862
- dockerfile := []byte (`
6863
- FROM busybox
6894
+ dockerfile := []byte (fmt .Sprintf (
6895
+ `
6896
+ FROM %s AS build
6864
6897
COPY <<EOF /out
6865
6898
hello world!
6866
6899
EOF
6867
- ` )
6900
+ ` ,
6901
+ integration .UnixOrWindows ("busybox" , "nanoserver" )))
6868
6902
6869
6903
dir := integration .Tmpdir (
6870
6904
t ,
@@ -6893,9 +6927,18 @@ EOF
6893
6927
require .NoError (t , err )
6894
6928
6895
6929
items , err := os .ReadDir (destDir )
6930
+
6931
+ fileNames := []string {}
6932
+
6933
+ for _ , item := range items {
6934
+ if item .Name () == "out" {
6935
+ fileNames = append (fileNames , item .Name ())
6936
+ }
6937
+ }
6938
+
6896
6939
require .NoError (t , err )
6897
- require .Equal (t , 1 , len (items ))
6898
- require .Equal (t , "out" , items [0 ]. Name () )
6940
+ require .Equal (t , 1 , len (fileNames ))
6941
+ require .Equal (t , "out" , fileNames [0 ])
6899
6942
6900
6943
dt , err := os .ReadFile (filepath .Join (destDir , "out" ))
6901
6944
require .NoError (t , err )
0 commit comments