Jonathan A. Sternberg cd017e98ed
revert: "bake: initial set of composable bake attributes"
This reverts commit 3ccbb88e6ad1a45f8ad8ebdfa91b4f524e3e6899.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2024-11-27 09:39:57 -06:00

37 lines
726 B
Go

package buildflags
import (
"strings"
controllerapi "github.com/docker/buildx/controller/pb"
"github.com/moby/buildkit/util/gitutil"
)
func ParseSSHSpecs(sl []string) ([]*controllerapi.SSH, error) {
var outs []*controllerapi.SSH
if len(sl) == 0 {
return nil, nil
}
for _, s := range sl {
parts := strings.SplitN(s, "=", 2)
out := controllerapi.SSH{
ID: parts[0],
}
if len(parts) > 1 {
out.Paths = strings.Split(parts[1], ",")
}
outs = append(outs, &out)
}
return outs, nil
}
// IsGitSSH returns true if the given repo URL is accessed over ssh
func IsGitSSH(repo string) bool {
url, err := gitutil.ParseURL(repo)
if err != nil {
return false
}
return url.Scheme == gitutil.SSHProtocol
}