@@ -1356,13 +1356,18 @@ RUN [ "$(stat -c "%U %G" /dest01)" == "user01 user" ]
13561356}
13571357
13581358func testCopyThroughSymlinkContext (t * testing.T , sb integration.Sandbox ) {
1359- integration .SkipOnPlatform (t , "windows" )
13601359 f := getFrontend (t , sb )
13611360
1362- dockerfile := []byte (`
1361+ dockerfile := []byte (integration .UnixOrWindows (
1362+ `
13631363FROM scratch
13641364COPY link/foo .
1365- ` )
1365+ ` ,
1366+ `
1367+ FROM nanoserver AS build
1368+ COPY link/foo .
1369+ ` ,
1370+ ))
13661371
13671372 dir := integration .Tmpdir (
13681373 t ,
@@ -1481,14 +1486,20 @@ COPY . /
14811486}
14821487
14831488func testIgnoreEntrypoint (t * testing.T , sb integration.Sandbox ) {
1484- integration .SkipOnPlatform (t , "windows" )
14851489 f := getFrontend (t , sb )
14861490
1487- dockerfile := []byte (`
1491+ dockerfile := []byte (integration .UnixOrWindows (
1492+ `
14881493FROM busybox
14891494ENTRYPOINT ["/nosuchcmd"]
14901495RUN ["ls"]
1491- ` )
1496+ ` ,
1497+ `
1498+ FROM nanoserver AS build
1499+ ENTRYPOINT ["nosuchcmd.exe"]
1500+ RUN dir
1501+ ` ,
1502+ ))
14921503
14931504 dir := integration .Tmpdir (
14941505 t ,
@@ -1509,10 +1520,10 @@ RUN ["ls"]
15091520}
15101521
15111522func testQuotedMetaArgs (t * testing.T , sb integration.Sandbox ) {
1512- integration .SkipOnPlatform (t , "windows" )
15131523 f := getFrontend (t , sb )
15141524
1515- dockerfile := []byte (`
1525+ dockerfile := []byte (integration .UnixOrWindows (
1526+ `
15161527ARG a1="box"
15171528ARG a2="$a1-foo"
15181529FROM busy$a1 AS build
@@ -1521,7 +1532,19 @@ ARG a3="bar-$a2"
15211532RUN echo -n $a3 > /out
15221533FROM scratch
15231534COPY --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+ ))
15251548
15261549 dir := integration .Tmpdir (
15271550 t ,
@@ -1550,7 +1573,10 @@ COPY --from=build /out .
15501573
15511574 dt , err := os .ReadFile (filepath .Join (destDir , "out" ))
15521575 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 ))
15541580}
15551581
15561582func testGlobalArgErrors (t * testing.T , sb integration.Sandbox ) {
@@ -6312,14 +6338,19 @@ COPY Dockerfile Dockerfile
63126338
63136339// moby/buildkit#1301
63146340func testDockerfileCheckHostname (t * testing.T , sb integration.Sandbox ) {
6315- integration .SkipOnPlatform (t , "windows" )
63166341 f := getFrontend (t , sb )
6317- dockerfile := []byte (`
6342+ dockerfile := []byte (integration .UnixOrWindows (
6343+ `
63186344FROM busybox
63196345RUN cat /etc/hosts | grep foo
63206346RUN echo $HOSTNAME | grep foo
63216347RUN 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+ ))
63236354
63246355 dir := integration .Tmpdir (
63256356 t ,
@@ -6370,11 +6401,8 @@ RUN echo $(hostname) | grep foo
63706401}
63716402
63726403func testEmptyStages (t * testing.T , sb integration.Sandbox ) {
6373- integration .SkipOnPlatform (t , "windows" )
63746404 f := getFrontend (t , sb )
6375- dockerfile := []byte (`
6376- ARG foo=bar
6377- ` )
6405+ dockerfile := []byte (`ARG foo=bar` )
63786406
63796407 dir := integration .Tmpdir (
63806408 t ,
@@ -6693,7 +6721,6 @@ COPY --from=base /env_foobar /
66936721}
66946722
66956723func testNamedImageContextPlatform (t * testing.T , sb integration.Sandbox ) {
6696- integration .SkipOnPlatform (t , "windows" )
66976724 workers .CheckFeatureCompat (t , sb , workers .FeatureDirectPush )
66986725 ctx := sb .Context ()
66996726
@@ -6708,7 +6735,13 @@ func testNamedImageContextPlatform(t *testing.T, sb integration.Sandbox) {
67086735 require .NoError (t , err )
67096736
67106737 // 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+
67126745 target := registry + "/buildkit/testnamedimagecontextplatform:latest"
67136746
67146747 dir := integration .Tmpdir (
@@ -6738,10 +6771,10 @@ func testNamedImageContextPlatform(t *testing.T, sb integration.Sandbox) {
67386771 }, nil )
67396772 require .NoError (t , err )
67406773
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 ) )
67456778
67466779 dir = integration .Tmpdir (
67476780 t ,
@@ -6852,19 +6885,20 @@ RUN echo foo >> /test
68526885}
68536886
68546887func testNamedImageContextScratch (t * testing.T , sb integration.Sandbox ) {
6855- integration .SkipOnPlatform (t , "windows" )
68566888 ctx := sb .Context ()
68576889
68586890 c , err := client .New (ctx , sb .Address ())
68596891 require .NoError (t , err )
68606892 defer c .Close ()
68616893
6862- dockerfile := []byte (`
6863- FROM busybox
6894+ dockerfile := []byte (fmt .Sprintf (
6895+ `
6896+ FROM %s AS build
68646897COPY <<EOF /out
68656898hello world!
68666899EOF
6867- ` )
6900+ ` ,
6901+ integration .UnixOrWindows ("busybox" , "nanoserver" )))
68686902
68696903 dir := integration .Tmpdir (
68706904 t ,
@@ -6893,9 +6927,18 @@ EOF
68936927 require .NoError (t , err )
68946928
68956929 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+
68966939 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 ])
68996942
69006943 dt , err := os .ReadFile (filepath .Join (destDir , "out" ))
69016944 require .NoError (t , err )
0 commit comments