Skip to content

Commit 70e3ef9

Browse files
authored
fix(api): inherit parent status for join and fork (#6186)
1 parent dc7444b commit 70e3ef9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

engine/api/workflow/execute_node_run.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ func executeNodeRun(ctx context.Context, db gorpmapper.SqlExecutorWithTx, store
121121
return nil, sdk.WrapError(err, "unable to load workflow run with id %d", workflowNodeRun.WorkflowRunID)
122122
}
123123

124+
n := wr.Workflow.WorkflowData.NodeByID(workflowNodeRun.WorkflowNodeID)
125+
124126
report := new(ProcessorReport)
125127
defer func(wnr *sdk.WorkflowNodeRun) {
126128
report.Add(ctx, *wnr)
@@ -133,10 +135,12 @@ func executeNodeRun(ctx context.Context, db gorpmapper.SqlExecutorWithTx, store
133135

134136
var newStatus = workflowNodeRun.Status
135137

136-
// If no stages ==> success
137-
if len(workflowNodeRun.Stages) == 0 {
138+
// For join and fork, reuse the status from parent
139+
if n.Type == sdk.NodeTypeJoin || n.Type == sdk.NodeTypeFork {
140+
parentStatus := sdk.ParameterFind(workflowNodeRun.BuildParameters, "cds.status")
141+
newStatus = parentStatus.Value
142+
} else if len(workflowNodeRun.Stages) == 0 { // If no stages ==> success
138143
newStatus = sdk.StatusSuccess
139-
workflowNodeRun.Done = time.Now()
140144
}
141145

142146
stagesTerminated := 0

0 commit comments

Comments
 (0)