buildLocalScope adds all of a nodes outputs to the local scope with the given prefix, as well as the global scope, if specified with a globalName
(scope *wfScope, prefix string, node *wfv1.NodeStatus)
| 3438 | // buildLocalScope adds all of a nodes outputs to the local scope with the given prefix, as well |
| 3439 | // as the global scope, if specified with a globalName |
| 3440 | func (woc *wfOperationCtx) buildLocalScope(scope *wfScope, prefix string, node *wfv1.NodeStatus) { |
| 3441 | // It may be that the node is a retry node, in which case we want to get the outputs of the last node |
| 3442 | // in the retry group instead of the retry node itself. |
| 3443 | if lastChildNode := woc.possiblyGetRetryChildNode(node); lastChildNode != nil { |
| 3444 | node = lastChildNode |
| 3445 | } |
| 3446 | |
| 3447 | if node.ID != "" { |
| 3448 | key := fmt.Sprintf("%s.id", prefix) |
| 3449 | scope.addParamToScope(key, node.ID) |
| 3450 | } |
| 3451 | |
| 3452 | if !node.StartedAt.Time.IsZero() { |
| 3453 | key := fmt.Sprintf("%s.startedAt", prefix) |
| 3454 | scope.addParamToScope(key, node.StartedAt.Format(time.RFC3339)) |
| 3455 | } |
| 3456 | |
| 3457 | if !node.FinishedAt.Time.IsZero() { |
| 3458 | key := fmt.Sprintf("%s.finishedAt", prefix) |
| 3459 | scope.addParamToScope(key, node.FinishedAt.Format(time.RFC3339)) |
| 3460 | } |
| 3461 | |
| 3462 | if node.PodIP != "" { |
| 3463 | key := fmt.Sprintf("%s.ip", prefix) |
| 3464 | scope.addParamToScope(key, node.PodIP) |
| 3465 | } |
| 3466 | if node.Phase != "" { |
| 3467 | key := fmt.Sprintf("%s.status", prefix) |
| 3468 | scope.addParamToScope(key, string(node.Phase)) |
| 3469 | } |
| 3470 | if node.HostNodeName != "" { |
| 3471 | key := fmt.Sprintf("%s.hostNodeName", prefix) |
| 3472 | scope.addParamToScope(key, node.HostNodeName) |
| 3473 | } |
| 3474 | woc.addOutputsToLocalScope(prefix, node.Outputs, scope) |
| 3475 | } |
| 3476 | |
| 3477 | func (woc *wfOperationCtx) addOutputsToLocalScope(prefix string, outputs *wfv1.Outputs, scope *wfScope) { |
| 3478 | if outputs == nil || scope == nil { |