Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): inherit parent status for join and fork #6186

Merged
merged 1 commit into from
Jun 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions engine/api/workflow/execute_node_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ func executeNodeRun(ctx context.Context, db gorpmapper.SqlExecutorWithTx, store
return nil, sdk.WrapError(err, "unable to load workflow run with id %d", workflowNodeRun.WorkflowRunID)
}

n := wr.Workflow.WorkflowData.NodeByID(workflowNodeRun.WorkflowNodeID)

report := new(ProcessorReport)
defer func(wnr *sdk.WorkflowNodeRun) {
report.Add(ctx, *wnr)
Expand All @@ -133,10 +135,12 @@ func executeNodeRun(ctx context.Context, db gorpmapper.SqlExecutorWithTx, store

var newStatus = workflowNodeRun.Status

// If no stages ==> success
if len(workflowNodeRun.Stages) == 0 {
// For join and fork, reuse the status from parent
if n.Type == sdk.NodeTypeJoin || n.Type == sdk.NodeTypeFork {
parentStatus := sdk.ParameterFind(workflowNodeRun.BuildParameters, "cds.status")
newStatus = parentStatus.Value
} else if len(workflowNodeRun.Stages) == 0 { // If no stages ==> success
newStatus = sdk.StatusSuccess
workflowNodeRun.Done = time.Now()
}

stagesTerminated := 0
Expand Down