mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 10:03:42 +08:00 
			
		
		
		
	We can perform all attestation processing, handling how the sbom and provenance arguments interact on the client, while applying defaults on the server. Additionally, this allows us to start pulling fields out of CommonOpts. Signed-off-by: Justin Chadwell <me@jedevc.com>
		
			
				
	
	
		
			21 lines
		
	
	
		
			366 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			366 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package pb
 | 
						|
 | 
						|
func CreateAttestations(attests []*Attest) map[string]*string {
 | 
						|
	result := map[string]*string{}
 | 
						|
	for _, attest := range attests {
 | 
						|
		// ignore duplicates
 | 
						|
		if _, ok := result[attest.Type]; ok {
 | 
						|
			continue
 | 
						|
		}
 | 
						|
 | 
						|
		if attest.Disabled {
 | 
						|
			result[attest.Type] = nil
 | 
						|
			continue
 | 
						|
		}
 | 
						|
 | 
						|
		attrs := attest.Attrs
 | 
						|
		result[attest.Type] = &attrs
 | 
						|
	}
 | 
						|
	return result
 | 
						|
}
 |