From 79a22fa907e2ca200fd33d371e260d867543e561 Mon Sep 17 00:00:00 2001 From: zc Date: Mon, 11 Mar 2024 21:11:01 +0800 Subject: [PATCH] fix inkctl exec log output --- core/clients/client_direct.go | 10 +++++++--- core/command/ctl.go | 9 --------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/core/clients/client_direct.go b/core/clients/client_direct.go index 59d9dd7..cd45173 100644 --- a/core/clients/client_direct.go +++ b/core/clients/client_direct.go @@ -74,16 +74,20 @@ func (c *clientDirect) Info(_ context.Context, stageID uint64) (*v1.Data, error) return data, nil } -func (c *clientDirect) StageBegin(_ context.Context, _ *v1.Stage) error { +func (c *clientDirect) StageBegin(_ context.Context, stage *v1.Stage) error { + fmt.Printf("\x1b[1m[STAGE:%s] %s\x1b[0m\n", stage.Worker.Kind, stage.Name) return nil } -func (c *clientDirect) StageEnd(_ context.Context, _ *v1.Stage) error { +func (c *clientDirect) StageEnd(_ context.Context, stage *v1.Stage) error { + if stage.Phase == v1.PhaseSkipped { + fmt.Printf("\x1b[1m[STAGE:%s](SKIPPED) %s\x1b[0m\n", stage.Worker.Kind, stage.Name) + } return nil } func (c *clientDirect) StepBegin(_ context.Context, step *v1.Step) error { - fmt.Printf("\x1b[1m%s\x1b[0m\n", "[STEP] "+step.Name) + fmt.Printf("\x1b[1m[STEP] %s\x1b[0m\n", step.Name) return nil } diff --git a/core/command/ctl.go b/core/command/ctl.go index 762fa01..b4b50dd 100644 --- a/core/command/ctl.go +++ b/core/command/ctl.go @@ -26,7 +26,6 @@ import ( "github.com/99nil/gopkg/printer" "github.com/spf13/cobra" - "github.com/zc2638/wslog" "golang.org/x/sync/errgroup" "gopkg.in/yaml.v3" @@ -627,13 +626,6 @@ func execBuild( data.Status.Steps = append(data.Status.Steps, step) } - log := wslog.With( - "name", workflow.GetName(), - "namespace", workflow.GetNamespace(), - "worker_kind", workerObj.Kind.String(), - ) - log.Info("Begin workflow") - eg, ctx := errgroup.WithContext(context.Background()) eg.Go(func() error { return worker.Run(ctx, wc, hook) }) eg.Go(func() error { @@ -646,7 +638,6 @@ func execBuild( if err := eg.Wait(); err != nil { return err } - log.Info("End workflow") } return nil }