updateOutboundNodes set the outbound nodes from the last step group
(ctx context.Context, nodeName string, tmpl *wfv1.Template)
| 198 | |
| 199 | // updateOutboundNodes set the outbound nodes from the last step group |
| 200 | func (woc *wfOperationCtx) updateOutboundNodes(ctx context.Context, nodeName string, tmpl *wfv1.Template) error { |
| 201 | outbound := make([]string, 0) |
| 202 | // Find the last, initialized stepgroup node |
| 203 | var lastSGNode *wfv1.NodeStatus |
| 204 | var err error |
| 205 | for i := len(tmpl.Steps) - 1; i >= 0; i-- { |
| 206 | var sgNode *wfv1.NodeStatus |
| 207 | sgNode, err = woc.wf.GetNodeByName(fmt.Sprintf("%s[%d]", nodeName, i)) |
| 208 | if err == nil { |
| 209 | lastSGNode = sgNode |
| 210 | break |
| 211 | } |
| 212 | } |
| 213 | if lastSGNode == nil { |
| 214 | woc.log.WithField("name", nodeName).Warn(ctx, "node had no initialized StepGroup nodes") |
| 215 | return err |
| 216 | } |
| 217 | for _, childID := range lastSGNode.Children { |
| 218 | outboundNodeIDs := woc.getOutboundNodes(ctx, childID) |
| 219 | woc.log.WithFields(logging.Fields{"childID": childID, "outboundNodeIDs": outboundNodeIDs}).Info(ctx, "Outbound nodes") |
| 220 | outbound = append(outbound, outboundNodeIDs...) |
| 221 | } |
| 222 | node, err := woc.wf.GetNodeByName(nodeName) |
| 223 | if err != nil { |
| 224 | return err |
| 225 | } |
| 226 | woc.log.WithFields(logging.Fields{"nodeID": node.ID, "outbound": outbound}).Info(ctx, "Outbound nodes") |
| 227 | node.OutboundNodes = outbound |
| 228 | woc.wf.Status.Nodes.Set(ctx, node.ID, *node) |
| 229 | return nil |
| 230 | } |
| 231 | |
| 232 | // executeStepGroup examines a list of parallel steps and executes them in parallel. |
| 233 | // Handles referencing of variables in scope, expands `withItem` clauses, and evaluates `when` expressions |
no test coverage detected