mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-10-31 16:13:45 +08:00 
			
		
		
		
	Implement new driver-opt: default-load
This eases build driver migrations, as it allows aligning the default behavior. See also https://docs.docker.com/build/drivers/ Signed-off-by: Niklas Gehlen <niklas@namespacelabs.com>
This commit is contained in:
		| @@ -169,6 +169,10 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opt map[s | ||||
| 	if noMobyDriver != nil && !noDefaultLoad() && noPrintFunc(opt) { | ||||
| 		var noOutputTargets []string | ||||
| 		for name, opt := range opt { | ||||
| 			if noMobyDriver.Features(ctx)[driver.DefaultLoad] { | ||||
| 				continue | ||||
| 			} | ||||
|  | ||||
| 			if !opt.Linked && len(opt.Exports) == 0 { | ||||
| 				noOutputTargets = append(noOutputTargets, name) | ||||
| 			} | ||||
|   | ||||
							
								
								
									
										12
									
								
								build/opt.go
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								build/opt.go
									
									
									
									
									
								
							| @@ -162,10 +162,14 @@ func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt Op | ||||
| 	case 1: | ||||
| 		// valid | ||||
| 	case 0: | ||||
| 		if nodeDriver.IsMobyDriver() && !noDefaultLoad() { | ||||
| 			// backwards compat for docker driver only: | ||||
| 			// this ensures the build results in a docker image. | ||||
| 			opt.Exports = []client.ExportEntry{{Type: "image", Attrs: map[string]string{}}} | ||||
| 		if !noDefaultLoad() { | ||||
| 			if nodeDriver.IsMobyDriver() { | ||||
| 				// backwards compat for docker driver only: | ||||
| 				// this ensures the build results in a docker image. | ||||
| 				opt.Exports = []client.ExportEntry{{Type: "image", Attrs: map[string]string{}}} | ||||
| 			} else if nodeDriver.Features(ctx)[driver.DefaultLoad] { | ||||
| 				opt.Exports = []client.ExportEntry{{Type: "docker", Attrs: map[string]string{}}} | ||||
| 			} | ||||
| 		} | ||||
| 	default: | ||||
| 		if err := bopts.LLBCaps.Supports(pb.CapMultipleExporters); err != nil { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Niklas Gehlen
					Niklas Gehlen