@@ -1047,3 +1047,48 @@ ENV FOO=bar
1047
1047
}, nil )
1048
1048
require .NoError (t , err )
1049
1049
}
1050
+
1051
+ // https://github.com/moby/buildkit/issues/3928
1052
+ func testDockerIgnoreMissingProvenance (t * testing.T , sb integration.Sandbox ) {
1053
+ integration .CheckFeatureCompat (t , sb , integration .FeatureProvenance )
1054
+ c , err := client .New (sb .Context (), sb .Address ())
1055
+ require .NoError (t , err )
1056
+ defer c .Close ()
1057
+
1058
+ dockerfile := []byte (`FROM alpine` )
1059
+ dirDockerfile , err := integration .Tmpdir (
1060
+ t ,
1061
+ fstest .CreateFile ("Dockerfile" , dockerfile , 0600 ),
1062
+ )
1063
+ require .NoError (t , err )
1064
+ dirContext , err := integration .Tmpdir (t )
1065
+ require .NoError (t , err )
1066
+
1067
+ frontend := func (ctx context.Context , c gateway.Client ) (* gateway.Result , error ) {
1068
+ // remove the directory to simulate the case where the context
1069
+ // directory does not exist, and either no validation checks were run,
1070
+ // or they passed erroneously
1071
+ if err := os .RemoveAll (dirContext ); err != nil {
1072
+ return nil , err
1073
+ }
1074
+
1075
+ res , err := c .Solve (ctx , gateway.SolveRequest {
1076
+ Frontend : "dockerfile.v0" ,
1077
+ })
1078
+ if err != nil {
1079
+ return nil , err
1080
+ }
1081
+ return res , nil
1082
+ }
1083
+
1084
+ _ , err = c .Build (sb .Context (), client.SolveOpt {
1085
+ FrontendAttrs : map [string ]string {
1086
+ "attest:provenance" : "mode=max" ,
1087
+ },
1088
+ LocalDirs : map [string ]string {
1089
+ dockerui .DefaultLocalNameDockerfile : dirDockerfile ,
1090
+ dockerui .DefaultLocalNameContext : dirContext ,
1091
+ },
1092
+ }, "" , frontend , nil )
1093
+ require .NoError (t , err )
1094
+ }
0 commit comments