@@ -1372,13 +1372,18 @@ RUN [ "$(stat -c "%U %G" /dest01)" == "user01 user" ]
1372
1372
}
1373
1373
1374
1374
func testCopyThroughSymlinkContext (t * testing.T , sb integration.Sandbox ) {
1375
- integration .SkipOnPlatform (t , "windows" )
1376
1375
f := getFrontend (t , sb )
1377
1376
1378
- dockerfile := []byte (`
1377
+ dockerfile := []byte (integration .UnixOrWindows (
1378
+ `
1379
1379
FROM scratch
1380
1380
COPY link/foo .
1381
- ` )
1381
+ ` ,
1382
+ `
1383
+ FROM nanoserver AS build
1384
+ COPY link/foo .
1385
+ ` ,
1386
+ ))
1382
1387
1383
1388
dir := integration .Tmpdir (
1384
1389
t ,
@@ -1497,14 +1502,20 @@ COPY . /
1497
1502
}
1498
1503
1499
1504
func testIgnoreEntrypoint (t * testing.T , sb integration.Sandbox ) {
1500
- integration .SkipOnPlatform (t , "windows" )
1501
1505
f := getFrontend (t , sb )
1502
1506
1503
- dockerfile := []byte (`
1507
+ dockerfile := []byte (integration .UnixOrWindows (
1508
+ `
1504
1509
FROM busybox
1505
1510
ENTRYPOINT ["/nosuchcmd"]
1506
1511
RUN ["ls"]
1507
- ` )
1512
+ ` ,
1513
+ `
1514
+ FROM nanoserver AS build
1515
+ ENTRYPOINT ["nosuchcmd.exe"]
1516
+ RUN dir
1517
+ ` ,
1518
+ ))
1508
1519
1509
1520
dir := integration .Tmpdir (
1510
1521
t ,
@@ -1525,10 +1536,10 @@ RUN ["ls"]
1525
1536
}
1526
1537
1527
1538
func testQuotedMetaArgs (t * testing.T , sb integration.Sandbox ) {
1528
- integration .SkipOnPlatform (t , "windows" )
1529
1539
f := getFrontend (t , sb )
1530
1540
1531
- dockerfile := []byte (`
1541
+ dockerfile := []byte (integration .UnixOrWindows (
1542
+ `
1532
1543
ARG a1="box"
1533
1544
ARG a2="$a1-foo"
1534
1545
FROM busy$a1 AS build
@@ -1537,7 +1548,19 @@ ARG a3="bar-$a2"
1537
1548
RUN echo -n $a3 > /out
1538
1549
FROM scratch
1539
1550
COPY --from=build /out .
1540
- ` )
1551
+ ` ,
1552
+ `
1553
+ ARG a1="server"
1554
+ ARG a2="$a1-foo"
1555
+ FROM nano$a1 AS build
1556
+ USER ContainerAdministrator
1557
+ ARG a2
1558
+ ARG a3="bar-$a2"
1559
+ RUN echo %a3% > /out
1560
+ FROM nanoserver
1561
+ COPY --from=build /out .
1562
+ ` ,
1563
+ ))
1541
1564
1542
1565
dir := integration .Tmpdir (
1543
1566
t ,
@@ -1566,7 +1589,10 @@ COPY --from=build /out .
1566
1589
1567
1590
dt , err := os .ReadFile (filepath .Join (destDir , "out" ))
1568
1591
require .NoError (t , err )
1569
- require .Equal (t , "bar-box-foo" , string (dt ))
1592
+
1593
+ testString := string ([]byte (integration .UnixOrWindows ("bar-box-foo" , "bar-server-foo \r \n " )))
1594
+
1595
+ require .Equal (t , testString , string (dt ))
1570
1596
}
1571
1597
1572
1598
func testGlobalArgErrors (t * testing.T , sb integration.Sandbox ) {
@@ -6641,14 +6667,19 @@ COPY Dockerfile Dockerfile
6641
6667
6642
6668
// moby/buildkit#1301
6643
6669
func testDockerfileCheckHostname (t * testing.T , sb integration.Sandbox ) {
6644
- integration .SkipOnPlatform (t , "windows" )
6645
6670
f := getFrontend (t , sb )
6646
- dockerfile := []byte (`
6671
+ dockerfile := []byte (integration .UnixOrWindows (
6672
+ `
6647
6673
FROM busybox
6648
6674
RUN cat /etc/hosts | grep foo
6649
6675
RUN echo $HOSTNAME | grep foo
6650
6676
RUN echo $(hostname) | grep foo
6651
- ` )
6677
+ ` ,
6678
+ `
6679
+ FROM nanoserver
6680
+ RUN reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname | findstr "foo"
6681
+ ` ,
6682
+ ))
6652
6683
6653
6684
dir := integration .Tmpdir (
6654
6685
t ,
@@ -6699,11 +6730,8 @@ RUN echo $(hostname) | grep foo
6699
6730
}
6700
6731
6701
6732
func testEmptyStages (t * testing.T , sb integration.Sandbox ) {
6702
- integration .SkipOnPlatform (t , "windows" )
6703
6733
f := getFrontend (t , sb )
6704
- dockerfile := []byte (`
6705
- ARG foo=bar
6706
- ` )
6734
+ dockerfile := []byte (`ARG foo=bar` )
6707
6735
6708
6736
dir := integration .Tmpdir (
6709
6737
t ,
@@ -7022,7 +7050,6 @@ COPY --from=base /env_foobar /
7022
7050
}
7023
7051
7024
7052
func testNamedImageContextPlatform (t * testing.T , sb integration.Sandbox ) {
7025
- integration .SkipOnPlatform (t , "windows" )
7026
7053
workers .CheckFeatureCompat (t , sb , workers .FeatureDirectPush )
7027
7054
ctx := sb .Context ()
7028
7055
@@ -7037,7 +7064,13 @@ func testNamedImageContextPlatform(t *testing.T, sb integration.Sandbox) {
7037
7064
require .NoError (t , err )
7038
7065
7039
7066
// Build a base image and force buildkit to generate a manifest list.
7040
- dockerfile := []byte (`FROM --platform=$BUILDPLATFORM alpine:latest` )
7067
+ baseImage := integration .UnixOrWindows (
7068
+ "alpine" ,
7069
+ "nanoserver" ,
7070
+ )
7071
+
7072
+ dockerfile := []byte (fmt .Sprintf (`FROM --platform=$BUILDPLATFORM %s:latest` , baseImage ))
7073
+
7041
7074
target := registry + "/buildkit/testnamedimagecontextplatform:latest"
7042
7075
7043
7076
dir := integration .Tmpdir (
@@ -7067,10 +7100,10 @@ func testNamedImageContextPlatform(t *testing.T, sb integration.Sandbox) {
7067
7100
}, nil )
7068
7101
require .NoError (t , err )
7069
7102
7070
- dockerfile = []byte (`
7071
- FROM --platform=$BUILDPLATFORM busybox AS target
7072
- RUN echo hello
7073
- ` )
7103
+ dockerfile = []byte (fmt . Sprintf ( `
7104
+ FROM --platform=$BUILDPLATFORM %s AS target
7105
+ RUN echo hello
7106
+ ` , baseImage ) )
7074
7107
7075
7108
dir = integration .Tmpdir (
7076
7109
t ,
@@ -7181,19 +7214,20 @@ RUN echo foo >> /test
7181
7214
}
7182
7215
7183
7216
func testNamedImageContextScratch (t * testing.T , sb integration.Sandbox ) {
7184
- integration .SkipOnPlatform (t , "windows" )
7185
7217
ctx := sb .Context ()
7186
7218
7187
7219
c , err := client .New (ctx , sb .Address ())
7188
7220
require .NoError (t , err )
7189
7221
defer c .Close ()
7190
7222
7191
- dockerfile := []byte (`
7192
- FROM busybox
7223
+ dockerfile := []byte (fmt .Sprintf (
7224
+ `
7225
+ FROM %s AS build
7193
7226
COPY <<EOF /out
7194
7227
hello world!
7195
7228
EOF
7196
- ` )
7229
+ ` ,
7230
+ integration .UnixOrWindows ("busybox" , "nanoserver" )))
7197
7231
7198
7232
dir := integration .Tmpdir (
7199
7233
t ,
@@ -7222,9 +7256,18 @@ EOF
7222
7256
require .NoError (t , err )
7223
7257
7224
7258
items , err := os .ReadDir (destDir )
7259
+
7260
+ fileNames := []string {}
7261
+
7262
+ for _ , item := range items {
7263
+ if item .Name () == "out" {
7264
+ fileNames = append (fileNames , item .Name ())
7265
+ }
7266
+ }
7267
+
7225
7268
require .NoError (t , err )
7226
- require .Equal (t , 1 , len (items ))
7227
- require .Equal (t , "out" , items [0 ]. Name () )
7269
+ require .Equal (t , 1 , len (fileNames ))
7270
+ require .Equal (t , "out" , fileNames [0 ])
7228
7271
7229
7272
dt , err := os .ReadFile (filepath .Join (destDir , "out" ))
7230
7273
require .NoError (t , err )
0 commit comments