Skip to content
Open
Show file tree
Hide file tree
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
22 changes: 11 additions & 11 deletions internal/impl/pure/processor_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,17 @@ func (w *Workflow) skipFromMeta(root any) map[string]struct{} {

gObj := gabs.Wrap(root)

// Skip stages that were already skipped in a previous run of this workflow.
if skipped, ok := gObj.S(append(w.metaPath, "skipped")...).Data().([]any); ok {
for _, id := range skipped {
if idStr, isString := id.(string); isString {
if _, exists := w.allStages[idStr]; exists {
skipList[idStr] = struct{}{}
}
}
}
}

// If a whitelist is provided for this flow then skip stages that aren't
// within it.
if apply, ok := gObj.S(append(w.metaPath, "apply")...).Data().([]any); ok {
Expand All @@ -424,17 +435,6 @@ func (w *Workflow) skipFromMeta(root any) map[string]struct{} {
}
}

// Skip stages that were already skipped in a previous run of this workflow.
if skipped, ok := gObj.S(append(w.metaPath, "skipped")...).Data().([]any); ok {
for _, id := range skipped {
if idStr, isString := id.(string); isString {
if _, exists := w.allStages[idStr]; exists {
skipList[idStr] = struct{}{}
}
}
}
}

return skipList
}

Expand Down
2 changes: 2 additions & 0 deletions internal/impl/pure/processor_workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,13 @@ func TestWorkflows(t *testing.T) {
msg(`{"meta":{"workflow":{"apply":["2"]}},"baz":2}`),
msg(`{"meta":{"workflow":{"skipped":["0"]}},"bar":3}`),
msg(`{"meta":{"workflow":{"succeeded":["1"]}},"baz":9}`),
msg(`{"bar":3,"baz":2,"meta":{"workflow":{"apply":["1","2"],"failed":{"0":"request mapping failed: failed assignment (line 1): field ` + "`this.foo`" + `: value is null"},"skipped":["1","2"]}}}`),
},
output: []mockMsg{
msg(`{"baz":2,"buz":4,"meta":{"workflow":{"previous":{"apply":["2"]},"skipped":["0","1"],"succeeded":["2"]}}}`),
msg(`{"bar":3,"baz":8,"buz":10,"meta":{"workflow":{"previous":{"skipped":["0"]},"skipped":["0"],"succeeded":["1","2"]}}}`),
msg(`{"baz":9,"buz":11,"meta":{"workflow":{"failed":{"0":"request mapping failed: failed assignment (line 1): field ` + "`this.foo`" + `: value is null"},"previous":{"succeeded":["1"]},"skipped":["1"],"succeeded":["2"]}}}`),
msg(`{"bar":3,"baz":8,"buz":10,"meta":{"workflow":{"previous":{"apply":["1","2"],"failed":{"0":"request mapping failed: failed assignment (line 1): field ` + "`this.foo`" + `: value is null"},"skipped":["1","2"]},"skipped":["0"],"succeeded":["1","2"]}}}`),
},
},
{
Expand Down