mirror of
https://github.com/kubevela/kubevela.git
synced 2026-02-14 18:10:21 +00:00
Fix: fix vela debug cli to find id for step (#5294)
Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com> Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com>
This commit is contained in:
@@ -143,8 +143,10 @@ func (d *debugOpts) debugWorkflow(ctx context.Context, wargs *WorkflowArgs, cli
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to select workflow step: %w", err)
|
||||
}
|
||||
d.step = unwrapStepName(step)
|
||||
d.step = unwrapStepID(step, wargs.WorkflowInstance)
|
||||
d.errMsg = d.errMap[d.step]
|
||||
} else {
|
||||
d.step = unwrapStepID(d.step, wargs.WorkflowInstance)
|
||||
}
|
||||
|
||||
// debug workflow steps
|
||||
@@ -261,6 +263,21 @@ func unwrapStepName(step string) string {
|
||||
}
|
||||
}
|
||||
|
||||
func unwrapStepID(step string, instance *wfTypes.WorkflowInstance) string {
|
||||
step = unwrapStepName(step)
|
||||
for _, status := range instance.Status.Steps {
|
||||
if status.Name == step {
|
||||
return status.ID
|
||||
}
|
||||
for _, sub := range status.SubStepsStatus {
|
||||
if sub.Name == step {
|
||||
return sub.ID
|
||||
}
|
||||
}
|
||||
}
|
||||
return step
|
||||
}
|
||||
|
||||
func (d *debugOpts) getDebugRawValue(ctx context.Context, cli client.Client, pd *packages.PackageDiscover, instance *wfTypes.WorkflowInstance) (*value.Value, string, error) {
|
||||
debugCM := &corev1.ConfigMap{}
|
||||
if err := cli.Get(ctx, client.ObjectKey{Name: debug.GenerateContextName(instance.Name, d.step, string(instance.UID)), Namespace: instance.Namespace}, debugCM); err != nil {
|
||||
|
||||
@@ -454,7 +454,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 = unwrapStepName(stepName)
|
||||
w.StepName = unwrapStepID(stepName, w.WorkflowInstance)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user