mirror of
https://github.com/kubevela/kubevela.git
synced 2026-02-23 22:33:58 +00:00
Compare commits
3 Commits
v1.7.7
...
release-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4209080adc | ||
|
|
61348b9d45 | ||
|
|
aa5e825683 |
@@ -277,9 +277,9 @@ func (opt *AdoptOptions) MultipleRun(f velacmd.Factory, cmd *cobra.Command) erro
|
||||
_, _ = fmt.Fprintf(opt.Out, "Warning: failed to list resources from %s/%s: %s", apiVersion, kind, err.Error())
|
||||
continue
|
||||
}
|
||||
engine := resourcetopology.New(opt.ResourceTopologyRule)
|
||||
dedup := make([]k8s.ResourceIdentifier, 0)
|
||||
for _, item := range list.Items {
|
||||
engine := resourcetopology.New(opt.ResourceTopologyRule)
|
||||
itemIdentifier := k8s.ResourceIdentifier{
|
||||
Name: item.GetName(),
|
||||
Namespace: item.GetNamespace(),
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -58,8 +58,10 @@ commonPeerResources: [{
|
||||
resource: "configMap"
|
||||
selectors: {
|
||||
name: [
|
||||
for v in context.data.spec.template.spec.volumes if v.configMap != _|_ if v.configMap.name != _|_ {
|
||||
v.configMap.name
|
||||
if context.data.spec.template.spec.volumes != _|_ {
|
||||
for v in context.data.spec.template.spec.volumes if v.configMap != _|_ if v.configMap.name != _|_ {
|
||||
v.configMap.name
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
@@ -68,8 +70,10 @@ commonPeerResources: [{
|
||||
resource: "secret"
|
||||
selectors: {
|
||||
name: [
|
||||
for v in context.data.spec.template.spec.volumes if v.secret != _|_ if v.secret.name != _|_ {
|
||||
v.secret.name
|
||||
if context.data.spec.template.spec.volumes != _|_ {
|
||||
for v in context.data.spec.template.spec.volumes if v.secret != _|_ if v.secret.name != _|_ {
|
||||
v.secret.name
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
@@ -243,6 +243,7 @@ type WorkflowArgs struct {
|
||||
Writer io.Writer
|
||||
Args common.Args
|
||||
StepName string
|
||||
StepID string
|
||||
ErrMap map[string]string
|
||||
App *v1beta1.Application
|
||||
WorkflowRun *workflowv1alpha1.WorkflowRun
|
||||
@@ -399,7 +400,7 @@ func (w *WorkflowArgs) printStepLogs(ctx context.Context, cli client.Client, ioS
|
||||
return w.printResourceLogs(ctx, cli, ioStreams, []wfTypes.Resource{{
|
||||
Namespace: types.DefaultKubeVelaNS,
|
||||
LabelSelector: w.ControllerLabels,
|
||||
}}, []string{fmt.Sprintf(`step_name="%s"`, w.StepName), fmt.Sprintf("%s/%s", w.WorkflowInstance.Namespace, w.WorkflowInstance.Name), "cue logs"})
|
||||
}}, []string{fmt.Sprintf(`stepSessionID="%s"`, w.StepID), fmt.Sprintf("%s/%s", w.WorkflowInstance.Namespace, w.WorkflowInstance.Name), "cue logs"})
|
||||
case logConfig.Source != nil:
|
||||
if len(logConfig.Source.Resources) > 0 {
|
||||
return w.printResourceLogs(ctx, cli, ioStreams, logConfig.Source.Resources, nil)
|
||||
@@ -454,7 +455,8 @@ 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)
|
||||
w.StepID = unwrapStepID(stepName, w.WorkflowInstance)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user