mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-31 23:58:03 +08:00
build: use buildkit's gitutil package to detect remote files
BuildKit's gitutil package behaves slightly differently than moby's urlutil, so we should rely on BuildKit's gitutil when detecting URLs to avoid cases of accidentally producing invalid build requests that can confuse users. Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
@@ -18,7 +18,6 @@ import (
|
||||
"github.com/docker/buildx/util/buildflags"
|
||||
"github.com/docker/buildx/util/platformutil"
|
||||
"github.com/docker/cli/cli/config"
|
||||
"github.com/docker/docker/builder/remotecontext/urlutil"
|
||||
hcl "github.com/hashicorp/hcl/v2"
|
||||
"github.com/moby/buildkit/client/llb"
|
||||
"github.com/moby/buildkit/session/auth/authprovider"
|
||||
@@ -884,7 +883,7 @@ func toBuildOpt(t *Target, inp *Input) (*build.Options, error) {
|
||||
dockerfilePath = *t.Dockerfile
|
||||
}
|
||||
|
||||
if !isRemoteResource(contextPath) && !path.IsAbs(dockerfilePath) {
|
||||
if !build.IsRemoteURL(contextPath) && !path.IsAbs(dockerfilePath) {
|
||||
dockerfilePath = path.Join(contextPath, dockerfilePath)
|
||||
}
|
||||
|
||||
@@ -1040,10 +1039,6 @@ func removeDupes(s []string) []string {
|
||||
return s[:i]
|
||||
}
|
||||
|
||||
func isRemoteResource(str string) bool {
|
||||
return urlutil.IsGitURL(str) || urlutil.IsURL(str)
|
||||
}
|
||||
|
||||
func parseOutputType(str string) string {
|
||||
csvReader := csv.NewReader(strings.NewReader(str))
|
||||
fields, err := csvReader.Read()
|
||||
|
Reference in New Issue
Block a user