mirror of
https://github.com/kubevela/kubevela.git
synced 2026-02-14 18:10:21 +00:00
Fix: fix step id to name in workflow logs (#5805)
Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com>
This commit is contained in:
@@ -19,6 +19,7 @@ package cli
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/fatih/color"
|
||||
@@ -34,6 +35,8 @@ import (
|
||||
"github.com/oam-dev/kubevela/references/appfile"
|
||||
)
|
||||
|
||||
var re = regexp.MustCompile(`^.*?"([^"]*)"`)
|
||||
|
||||
// NewLogsCommand creates `logs` command to tail logs of application
|
||||
func NewLogsCommand(c common.Args, order string, ioStreams util.IOStreams) *cobra.Command {
|
||||
largs := &Args{Args: c}
|
||||
@@ -122,6 +125,10 @@ func (l *Args) printPodLogs(ctx context.Context, ioStreams util.IOStreams, selec
|
||||
}
|
||||
}
|
||||
if show {
|
||||
match := re.FindStringSubmatch(str)
|
||||
if len(match) > 1 {
|
||||
str = strings.ReplaceAll(match[1], "\\n", "\n")
|
||||
}
|
||||
ioStreams.Infonln(str)
|
||||
}
|
||||
case <-ctx.Done():
|
||||
|
||||
@@ -467,7 +467,7 @@ func (w *WorkflowArgs) selectWorkflowStep(msg string) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to select step %s: %w", unwrapStepName(w.StepName), err)
|
||||
}
|
||||
w.StepName = unwrapStepID(stepName, w.WorkflowInstance)
|
||||
w.StepName = unwrapStepName(stepName)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user