Merge pull request #3459 from crazy-max/history-input-context

history: input:context attribute support
This commit is contained in:
CrazyMax
2025-10-22 21:23:35 +02:00
committed by GitHub
122 changed files with 19214 additions and 18348 deletions
+1 -1
View File
@@ -243,7 +243,7 @@ workers0:
}
delete(attrs, "filename")
out.Name = buildName(rec.FrontendAttrs, st)
out.Name = BuildName(rec.FrontendAttrs, st)
out.Ref = rec.Ref
out.Context = context
+1 -1
View File
@@ -85,7 +85,7 @@ func runLs(ctx context.Context, dockerCli command.Cli, opts lsOptions) error {
for i, rec := range out {
st, _ := ls.ReadRef(rec.node.Builder, rec.node.Name, rec.Ref)
rec.name = buildName(rec.FrontendAttrs, st)
rec.name = BuildName(rec.FrontendAttrs, st)
out[i] = rec
}
+7 -2
View File
@@ -25,7 +25,7 @@ import (
const recordsLimit = 50
func buildName(fattrs map[string]string, ls *localstate.State) string {
func BuildName(fattrs map[string]string, ls *localstate.State) string {
if v, ok := fattrs["build-arg:BUILDKIT_BUILD_NAME"]; ok && v != "" {
return v
}
@@ -43,6 +43,10 @@ func buildName(fattrs map[string]string, ls *localstate.State) string {
}
if v, ok := fattrs["vcs:source"]; ok {
vcsSource = v
} else if v, ok := fattrs["input:context"]; ok {
if _, ok, _ := dfgitutil.ParseGitRef(v); ok {
vcsSource = v
}
}
if v, ok := fattrs["filename"]; ok && v != "Dockerfile" {
dockerfilePath = filepath.ToSlash(v)
@@ -99,7 +103,8 @@ func buildName(fattrs map[string]string, ls *localstate.State) string {
}
}
if res == "" && vcsSource != "" {
return vcsSource
u, _ := dfgitutil.FragmentFormat(vcsSource)
return u
}
return res
}