Skip to content

Commit

Permalink
--exec-stats requires logbus (#3530)
Browse files Browse the repository at this point in the history
prevent --exec-stats data from getting dumped to stdout when legacy
non-logbus code is used.

Signed-off-by: Alex Couture-Beil <[email protected]>
  • Loading branch information
alexcb authored Nov 24, 2023
1 parent d1617ec commit 3d833eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/earthly/subcmd/build_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@ func (a *Build) ActionBuildImp(cliCtx *cli.Context, flagArgs, nonFlagArgs []stri
var logbusSM *solvermon.SolverMonitor
if a.cli.Flags().Logstream {
logbusSM = a.cli.LogbusSetup().SolverMonitor
} else if a.cli.Flags().DisplayExecStats {
return fmt.Errorf("the --exec-stats feature is only available when --logstream is enabled")
}

builderOpts := builder.Opt{
Expand Down
5 changes: 5 additions & 0 deletions outmon/solvermon.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/dustin/go-humanize"
"github.com/earthly/earthly/conslogging"
"github.com/earthly/earthly/logbus/formatter"
"github.com/earthly/earthly/util/buildkitutil"
"github.com/earthly/earthly/util/vertexmeta"
"github.com/moby/buildkit/client"
Expand Down Expand Up @@ -192,6 +193,10 @@ func (sm *SolverMonitor) processStatus(ss *client.SolveStatus) error {
if !vm.headerPrinted {
sm.printHeader(vm)
}
if logLine.Stream == formatter.BuildkitStatsStream {
// --exec-stats requires logbus to be enabled
continue
}
err := sm.printOutput(vm, logLine.Data)
if err != nil {
return err
Expand Down

0 comments on commit 3d833eb

Please sign in to comment.