Skip to content

Commit

Permalink
Signed-off-by: tooptoop4 <[email protected]>
Browse files Browse the repository at this point in the history
  • Loading branch information
tooptoop4 authored Nov 6, 2024
1 parent efbf8a2 commit 7ee13e2
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions workflow/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3089,34 +3089,36 @@ func (woc *wfOperationCtx) buildLocalScope(scope *wfScope, prefix string, node *
node = lastChildNode
}

if node.ID != "" {
key := fmt.Sprintf("%s.id", prefix)
scope.addParamToScope(key, node.ID)
}
if node != nil {
if node.ID != "" {
key := fmt.Sprintf("%s.id", prefix)
scope.addParamToScope(key, node.ID)
}

if !node.StartedAt.Time.IsZero() {
key := fmt.Sprintf("%s.startedAt", prefix)
scope.addParamToScope(key, node.StartedAt.Time.Format(time.RFC3339))
}
if !node.StartedAt.Time.IsZero() {
key := fmt.Sprintf("%s.startedAt", prefix)
scope.addParamToScope(key, node.StartedAt.Time.Format(time.RFC3339))
}

if !node.FinishedAt.Time.IsZero() {
key := fmt.Sprintf("%s.finishedAt", prefix)
scope.addParamToScope(key, node.FinishedAt.Time.Format(time.RFC3339))
}
if !node.FinishedAt.Time.IsZero() {
key := fmt.Sprintf("%s.finishedAt", prefix)
scope.addParamToScope(key, node.FinishedAt.Time.Format(time.RFC3339))
}

if node.PodIP != "" {
key := fmt.Sprintf("%s.ip", prefix)
scope.addParamToScope(key, node.PodIP)
}
if node.Phase != "" {
key := fmt.Sprintf("%s.status", prefix)
scope.addParamToScope(key, string(node.Phase))
}
if node.HostNodeName != "" {
key := fmt.Sprintf("%s.hostNodeName", prefix)
scope.addParamToScope(key, string(node.HostNodeName))
if node.PodIP != "" {
key := fmt.Sprintf("%s.ip", prefix)
scope.addParamToScope(key, node.PodIP)
}
if node.Phase != "" {
key := fmt.Sprintf("%s.status", prefix)
scope.addParamToScope(key, string(node.Phase))
}
if node.HostNodeName != "" {
key := fmt.Sprintf("%s.hostNodeName", prefix)
scope.addParamToScope(key, string(node.HostNodeName))
}
woc.addOutputsToLocalScope(prefix, node.Outputs, scope)
}
woc.addOutputsToLocalScope(prefix, node.Outputs, scope)
}

func (woc *wfOperationCtx) addOutputsToLocalScope(prefix string, outputs *wfv1.Outputs, scope *wfScope) {
Expand Down

0 comments on commit 7ee13e2

Please sign in to comment.