mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 05:27:07 +08:00
bake: allow text descriptions for targets
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
@ -675,7 +675,8 @@ type Group struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Target struct {
|
type Target struct {
|
||||||
Name string `json:"-" hcl:"name,label" cty:"name"`
|
Name string `json:"-" hcl:"name,label" cty:"name"`
|
||||||
|
Description string `json:"description,omitempty" hcl:"description,optional" cty:"description"`
|
||||||
|
|
||||||
// Inherits is the only field that cannot be overridden with --set
|
// Inherits is the only field that cannot be overridden with --set
|
||||||
Inherits []string `json:"inherits,omitempty" hcl:"inherits,optional" cty:"inherits"`
|
Inherits []string `json:"inherits,omitempty" hcl:"inherits,optional" cty:"inherits"`
|
||||||
@ -823,6 +824,9 @@ func (t *Target) Merge(t2 *Target) {
|
|||||||
if t2.Ulimits != nil { // merge
|
if t2.Ulimits != nil { // merge
|
||||||
t.Ulimits = append(t.Ulimits, t2.Ulimits...)
|
t.Ulimits = append(t.Ulimits, t2.Ulimits...)
|
||||||
}
|
}
|
||||||
|
if t2.Description != "" {
|
||||||
|
t.Description = t2.Description
|
||||||
|
}
|
||||||
t.Inherits = append(t.Inherits, t2.Inherits...)
|
t.Inherits = append(t.Inherits, t2.Inherits...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,11 +337,16 @@ func runBake(ctx context.Context, dockerCli command.Cli, targets []string, in ba
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if sep {
|
if sep {
|
||||||
fmt.Fprintf(dockerCli.Out(), "\n\n")
|
fmt.Fprintln(dockerCli.Out())
|
||||||
} else {
|
} else {
|
||||||
sep = true
|
sep = true
|
||||||
}
|
}
|
||||||
fmt.Fprintf(dockerCli.Out(), "%s\n", name)
|
fmt.Fprintf(dockerCli.Out(), "%s\n", name)
|
||||||
|
if descr := tgts[name].Description; descr != "" {
|
||||||
|
fmt.Fprintf(dockerCli.Out(), "%s\n", descr)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Fprintln(dockerCli.Out())
|
||||||
if code, err := printResult(dockerCli.Out(), pf, res); err != nil {
|
if code, err := printResult(dockerCli.Out(), pf, res); err != nil {
|
||||||
fmt.Fprintf(dockerCli.Out(), "error: %v\n", err)
|
fmt.Fprintf(dockerCli.Out(), "error: %v\n", err)
|
||||||
exitCode = 1
|
exitCode = 1
|
||||||
|
@ -890,7 +890,7 @@ func printResult(w io.Writer, f *controllerapi.PrintFunc, res map[string]string)
|
|||||||
// but here we want to print the error in a way that's consistent with how
|
// but here we want to print the error in a way that's consistent with how
|
||||||
// the lint warnings are printed via the `lint.PrintLintViolations` function,
|
// the lint warnings are printed via the `lint.PrintLintViolations` function,
|
||||||
// which differs from the default error printing.
|
// which differs from the default error printing.
|
||||||
if f.Format != "json" {
|
if f.Format != "json" && len(lintResults.Warnings) > 0 {
|
||||||
fmt.Fprintln(w)
|
fmt.Fprintln(w)
|
||||||
}
|
}
|
||||||
lintBuf := bytes.NewBuffer([]byte(lintResults.Error.Message + "\n"))
|
lintBuf := bytes.NewBuffer([]byte(lintResults.Error.Message + "\n"))
|
||||||
|
Reference in New Issue
Block a user