mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 09:17:49 +08:00
monitor: resolve oci layout path in client
Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
parent
17105bfc50
commit
b5ea989eee
@ -676,19 +676,28 @@ func resolvePaths(options *controllerapi.BuildOptions) (_ *controllerapi.BuildOp
|
|||||||
}
|
}
|
||||||
var contexts map[string]string
|
var contexts map[string]string
|
||||||
for k, v := range options.NamedContexts {
|
for k, v := range options.NamedContexts {
|
||||||
p := v
|
if urlutil.IsGitURL(v) || urlutil.IsURL(v) || strings.HasPrefix(v, "docker-image://") {
|
||||||
if !urlutil.IsGitURL(p) && !urlutil.IsURL(p) && !strings.HasPrefix(p, "docker-image://") && !strings.HasPrefix(p, "oci-layout://") {
|
// url prefix, this is a remote path
|
||||||
// named context can specify non-path value
|
} else if strings.HasPrefix(v, "oci-layout://") {
|
||||||
// https://github.com/docker/buildx/blob/v0.10.3/docs/reference/buildx_build.md#-additional-build-contexts---build-context
|
// oci layout prefix, this is a local path
|
||||||
|
p := strings.TrimPrefix(v, "oci-layout://")
|
||||||
p, err = filepath.Abs(p)
|
p, err = filepath.Abs(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
v = "oci-layout://" + p
|
||||||
|
} else {
|
||||||
|
// no prefix, assume local path
|
||||||
|
v, err = filepath.Abs(v)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if contexts == nil {
|
if contexts == nil {
|
||||||
contexts = make(map[string]string)
|
contexts = make(map[string]string)
|
||||||
}
|
}
|
||||||
contexts[k] = p
|
contexts[k] = v
|
||||||
}
|
}
|
||||||
options.NamedContexts = contexts
|
options.NamedContexts = contexts
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user