mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-01 00:23:56 +08:00 
			
		
		
		
	build: error when using docker exporter and attestations
Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
		| @@ -447,6 +447,25 @@ func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt Op | ||||
| 		so.FrontendAttrs["multi-platform"] = "true" | ||||
| 	} | ||||
|  | ||||
| 	attests := make(map[string]string) | ||||
| 	for k, v := range opt.Attests { | ||||
| 		if v != nil { | ||||
| 			attests[k] = *v | ||||
| 		} | ||||
| 	} | ||||
| 	supportsAttestations := bopts.LLBCaps.Contains(apicaps.CapID("exporter.image.attestations")) | ||||
| 	if len(attests) > 0 { | ||||
| 		if !supportsAttestations { | ||||
| 			return nil, nil, errors.Errorf("attestations are not supported by the current buildkitd") | ||||
| 		} | ||||
| 		for k, v := range attests { | ||||
| 			so.FrontendAttrs[k] = v | ||||
| 		} | ||||
| 	} | ||||
| 	if _, ok := opt.Attests["attest:provenance"]; !ok && supportsAttestations { | ||||
| 		so.FrontendAttrs["attest:provenance"] = "mode=min,inline-only=true" | ||||
| 	} | ||||
|  | ||||
| 	switch len(opt.Exports) { | ||||
| 	case 1: | ||||
| 		// valid | ||||
| @@ -504,7 +523,7 @@ func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt Op | ||||
| 			return nil, nil, notSupported(nodeDriver, driver.OCIExporter) | ||||
| 		} | ||||
| 		if e.Type == "docker" { | ||||
| 			if len(opt.Platforms) > 1 { | ||||
| 			if len(opt.Platforms) > 1 || len(attests) > 0 { | ||||
| 				return nil, nil, errors.Errorf("docker exporter does not currently support exporting manifest lists") | ||||
| 			} | ||||
| 			if e.Output == nil { | ||||
| @@ -588,25 +607,6 @@ func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt Op | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	attests := make(map[string]string) | ||||
| 	for k, v := range opt.Attests { | ||||
| 		if v != nil { | ||||
| 			attests[k] = *v | ||||
| 		} | ||||
| 	} | ||||
| 	supportsAttestations := bopts.LLBCaps.Contains(apicaps.CapID("exporter.image.attestations")) | ||||
| 	if len(attests) > 0 { | ||||
| 		if !supportsAttestations { | ||||
| 			return nil, nil, errors.Errorf("attestations are not supported by the current buildkitd") | ||||
| 		} | ||||
| 		for k, v := range attests { | ||||
| 			so.FrontendAttrs[k] = v | ||||
| 		} | ||||
| 	} | ||||
| 	if _, ok := opt.Attests["attest:provenance"]; !ok && supportsAttestations { | ||||
| 		so.FrontendAttrs["attest:provenance"] = "mode=min,inline-only=true" | ||||
| 	} | ||||
|  | ||||
| 	// set platforms | ||||
| 	if len(opt.Platforms) != 0 { | ||||
| 		pp := make([]string, len(opt.Platforms)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Justin Chadwell
					Justin Chadwell