mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 01:53:42 +08:00 
			
		
		
		
	Strongly typing the API allows us to perform all command line parsing fully on the client-side, where we have access to the client local directory and all the client environment variables, which may not be available on the remote server. Additionally, the controller api starts to look a lot like build.Options, so at some point in the future there may be an oppportunity to merge the two, which would allow both build and bake to execute through the controller, instead of needing to maintain multiple code paths. Signed-off-by: Justin Chadwell <me@jedevc.com>
		
			
				
	
	
		
			23 lines
		
	
	
		
			544 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			544 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package pb
 | 
						|
 | 
						|
import (
 | 
						|
	"github.com/moby/buildkit/session"
 | 
						|
	"github.com/moby/buildkit/session/secrets/secretsprovider"
 | 
						|
)
 | 
						|
 | 
						|
func CreateSecrets(secrets []*Secret) (session.Attachable, error) {
 | 
						|
	fs := make([]secretsprovider.Source, 0, len(secrets))
 | 
						|
	for _, secret := range secrets {
 | 
						|
		fs = append(fs, secretsprovider.Source{
 | 
						|
			ID:       secret.ID,
 | 
						|
			FilePath: secret.FilePath,
 | 
						|
			Env:      secret.Env,
 | 
						|
		})
 | 
						|
	}
 | 
						|
	store, err := secretsprovider.NewStore(fs)
 | 
						|
	if err != nil {
 | 
						|
		return nil, err
 | 
						|
	}
 | 
						|
	return secretsprovider.NewSecretProvider(store), nil
 | 
						|
}
 |