Skip to content

Commit

Permalink
Merge pull request #2252 from ndeloof/rawjson
Browse files Browse the repository at this point in the history
don't print build details when progress is rawjson
  • Loading branch information
tonistiigi authored Feb 10, 2024
2 parents d0177c6 + 598bc16 commit 67d9385
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion commands/bake.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func runBake(ctx context.Context, dockerCli command.Cli, targets []string, in ba
if err == nil {
err = err1
}
if err == nil && progressMode != progressui.QuietMode {
if err == nil && progressMode != progressui.QuietMode && progressMode != progressui.RawJSONMode {
desktop.PrintBuildDetails(os.Stderr, printer.BuildRefs(), term)
}
}
Expand Down
11 changes: 7 additions & 4 deletions commands/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,13 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
return retErr
}

if progressMode != progressui.QuietMode {
desktop.PrintBuildDetails(os.Stderr, printer.BuildRefs(), term)
} else {
switch progressMode {
case progressui.RawJSONMode:
// no additional display
case progressui.QuietMode:
fmt.Println(getImageID(resp.ExporterResponse))
default:
desktop.PrintBuildDetails(os.Stderr, printer.BuildRefs(), term)
}
if options.imageIDFile != "" {
if err := os.WriteFile(options.imageIDFile, []byte(getImageID(resp.ExporterResponse)), 0644); err != nil {
Expand Down Expand Up @@ -753,7 +756,7 @@ func dockerUlimitToControllerUlimit(u *dockeropts.UlimitOpt) *controllerapi.Ulim
}

func printWarnings(w io.Writer, warnings []client.VertexWarning, mode progressui.DisplayMode) {
if len(warnings) == 0 || mode == progressui.QuietMode {
if len(warnings) == 0 || mode == progressui.QuietMode || mode == progressui.RawJSONMode {
return
}
fmt.Fprintf(w, "\n ")
Expand Down

0 comments on commit 67d9385

Please sign in to comment.