@@ -156,6 +156,7 @@ var allTests = integration.TestFuncs(
156
156
testSecretSSHProvenance ,
157
157
testNilProvenance ,
158
158
testSBOMScannerArgs ,
159
+ testMultiPlatformWarnings ,
159
160
)
160
161
161
162
// Tests that depend on the `security.*` entitlements
@@ -6394,6 +6395,81 @@ ARG BUILDKIT_SBOM_SCAN_STAGE=true
6394
6395
require .Equal (t , 1 , len (att .LayersRaw ))
6395
6396
}
6396
6397
6398
+ // #3495
6399
+ func testMultiPlatformWarnings (t * testing.T , sb integration.Sandbox ) {
6400
+ f := getFrontend (t , sb )
6401
+
6402
+ // empty line in here is intentional to cause line continuation warning
6403
+ dockerfile := []byte (`
6404
+ FROM scratch
6405
+ COPY Dockerfile \
6406
+
6407
+ .
6408
+ ` )
6409
+
6410
+ dir , err := integration .Tmpdir (
6411
+ t ,
6412
+ fstest .CreateFile ("Dockerfile" , dockerfile , 0600 ),
6413
+ )
6414
+ require .NoError (t , err )
6415
+ defer os .RemoveAll (dir )
6416
+
6417
+ c , err := client .New (sb .Context (), sb .Address ())
6418
+ require .NoError (t , err )
6419
+ defer c .Close ()
6420
+
6421
+ status := make (chan * client.SolveStatus )
6422
+ statusDone := make (chan struct {})
6423
+ done := make (chan struct {})
6424
+
6425
+ var warnings []* client.VertexWarning
6426
+
6427
+ go func () {
6428
+ defer close (statusDone )
6429
+ for {
6430
+ select {
6431
+ case st , ok := <- status :
6432
+ if ! ok {
6433
+ return
6434
+ }
6435
+ warnings = append (warnings , st .Warnings ... )
6436
+ case <- done :
6437
+ return
6438
+ }
6439
+ }
6440
+ }()
6441
+
6442
+ _ , err = f .Solve (sb .Context (), c , client.SolveOpt {
6443
+ FrontendAttrs : map [string ]string {
6444
+ "platform" : "linux/amd64,linux/arm64" ,
6445
+ },
6446
+ LocalDirs : map [string ]string {
6447
+ builder .DefaultLocalNameDockerfile : dir ,
6448
+ builder .DefaultLocalNameContext : dir ,
6449
+ },
6450
+ }, status )
6451
+ require .NoError (t , err )
6452
+
6453
+ select {
6454
+ case <- statusDone :
6455
+ case <- time .After (10 * time .Second ):
6456
+ close (done )
6457
+ }
6458
+
6459
+ <- statusDone
6460
+
6461
+ // two platforms only show one warning
6462
+ require .Equal (t , 1 , len (warnings ))
6463
+
6464
+ w := warnings [0 ]
6465
+
6466
+ require .Equal (t , "Empty continuation line found in: COPY Dockerfile ." , string (w .Short ))
6467
+ require .Equal (t , 1 , len (w .Detail ))
6468
+ require .Equal (t , "Empty continuation lines will become errors in a future release" , string (w .Detail [0 ]))
6469
+ require .Equal (t , "https://github.com/moby/moby/pull/33719" , w .URL )
6470
+ require .Equal (t , 1 , w .Level )
6471
+ }
6472
+
6397
6473
func runShell (dir string , cmds ... string ) error {
6398
6474
for _ , args := range cmds {
6399
6475
var cmd * exec.Cmd
0 commit comments