Skip to content
Permalink
Browse files
fix(render): live output in verbose/debug mode does not work properly
Signed-off-by: Alexey Igrychev <alexey.igrychev@flant.com>
  • Loading branch information
alexey-igrychev committed Jul 26, 2022
1 parent a40255a commit 50327800cda0a2be39b8d68bdf70147965368426
Showing 1 changed file with 24 additions and 15 deletions.
@@ -16,6 +16,7 @@ import (
"helm.sh/helm/v3/pkg/cli/values"

"github.com/werf/logboek"
"github.com/werf/logboek/pkg/level"
"github.com/werf/werf/cmd/werf/common"
"github.com/werf/werf/pkg/build"
"github.com/werf/werf/pkg/config/deploy_params"
@@ -306,24 +307,32 @@ func runRender(ctx context.Context) error {
defer conveyorWithRetry.Terminate()

if err := conveyorWithRetry.WithRetryBlock(ctx, func(c *build.Conveyor) error {
buf := new(bytes.Buffer)
bufLogger := logboek.NewLogger(buf, buf)
ctxWithBufLogger := logboek.NewContext(ctx, bufLogger)

var buildErr error
if *commonCmdData.SkipBuild {
shouldBeBuiltOptions, err := common.GetShouldBeBuiltOptions(&commonCmdData, giterminismManager, werfConfig)
if err != nil {
return err
buildFunc := func(ctx context.Context) error {
if *commonCmdData.SkipBuild {
shouldBeBuiltOptions, err := common.GetShouldBeBuiltOptions(&commonCmdData, giterminismManager, werfConfig)
if err != nil {
return err
}

return c.ShouldBeBuilt(ctx, shouldBeBuiltOptions)
}

buildErr = c.ShouldBeBuilt(ctxWithBufLogger, shouldBeBuiltOptions)
} else {
buildErr = c.Build(ctxWithBufLogger, buildOptions)
return c.Build(ctx, buildOptions)
}
if buildErr != nil {
fmt.Println(buf.String())
return buildErr

if logboek.Context(ctx).IsAcceptedLevel(level.Default) {
if err := buildFunc(ctx); err != nil {
return err
}
} else {
buf := new(bytes.Buffer)
bufLogger := logboek.NewLogger(buf, buf)
ctxWithBufLogger := logboek.NewContext(ctx, bufLogger)

if err := buildFunc(ctxWithBufLogger); err != nil {
fmt.Println(buf.String())
return err
}
}

imagesInfoGetters = c.GetImageInfoGetters(image.InfoGetterOptions{CustomTagFunc: useCustomTagFunc})

0 comments on commit 5032780

Please sign in to comment.