mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
remove uses of github.com/docker/docker/builder/remotecontext package
This package is part of the classic builder, and was currently only used for the IsURL utility, which is a very rudimentary check for a string having a "https://" or "http://" scheme. This patch copies the code as non-exported functions where they're used to remove the dependency. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@ -11,7 +11,6 @@ import (
|
||||
|
||||
"github.com/docker/buildx/driver"
|
||||
"github.com/docker/cli/opts"
|
||||
"github.com/docker/docker/builder/remotecontext/urlutil"
|
||||
"github.com/moby/buildkit/util/gitutil"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
@ -26,8 +25,15 @@ const (
|
||||
mobyHostGatewayName = "host-gateway"
|
||||
)
|
||||
|
||||
// isHTTPURL returns true if the provided str is an HTTP(S) URL by checking if it
|
||||
// has a http:// or https:// scheme. No validation is performed to verify if the
|
||||
// URL is well-formed.
|
||||
func isHTTPURL(str string) bool {
|
||||
return strings.HasPrefix(str, "https://") || strings.HasPrefix(str, "http://")
|
||||
}
|
||||
|
||||
func IsRemoteURL(c string) bool {
|
||||
if urlutil.IsURL(c) {
|
||||
if isHTTPURL(c) {
|
||||
return true
|
||||
}
|
||||
if _, err := gitutil.ParseGitRef(c); err == nil {
|
||||
|
Reference in New Issue
Block a user