bake: set input:context for remote builds

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2026-02-09 13:50:19 +01:00
parent 06f438a4c8
commit f60c7c9069
4 changed files with 148 additions and 1 deletions
+7
View File
@@ -35,6 +35,7 @@ import (
"github.com/moby/buildkit/client/llb"
"github.com/moby/buildkit/client/ociindex"
"github.com/moby/buildkit/exporter/containerimage/exptypes"
"github.com/moby/buildkit/frontend/dockerfile/dfgitutil"
"github.com/moby/buildkit/frontend/dockerui"
gateway "github.com/moby/buildkit/frontend/gateway/client"
"github.com/moby/buildkit/identity"
@@ -651,6 +652,9 @@ func loadInputs(ctx context.Context, d *driver.DriverHandle, inp *Inputs, pw pro
}
target.FrontendInputs["context"] = *inp.ContextState
target.FrontendInputs["dockerfile"] = *inp.ContextState
if _, ok, _ := dfgitutil.ParseGitRef(inp.ContextPath); ok {
target.FrontendAttrs["input:context"] = inp.ContextPath
}
case inp.ContextPath == "-":
if inp.DockerfilePath == "-" {
return nil, errors.Errorf("invalid argument: can't use stdin for both build context and dockerfile")
@@ -804,6 +808,9 @@ func loadInputs(ctx context.Context, d *driver.DriverHandle, inp *Inputs, pw pro
caps["moby.buildkit.frontend.contexts+forward"] = struct{}{}
if v.State != nil {
target.FrontendAttrs["context:"+k] = "input:" + k
if _, ok, _ := dfgitutil.ParseGitRef(v.Path); ok {
target.FrontendAttrs["input:git_state_"+k] = v.Path
}
if target.FrontendInputs == nil {
target.FrontendInputs = make(map[string]llb.State)
}