From 859aec34ebb3844e70f5ae98cbc4b7ede1879dc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Jerman?= Date: Fri, 8 Oct 2021 17:18:01 +0200 Subject: [PATCH] Revert "Fixes Wf duplicate issues for gateway steps" This reverts commit d4bf6fc6bb167a93944a4beb3b752f2def7db5f6. --- automation/service/workflow_converter.go | 17 +++++++---------- pkg/wfexec/gateways.go | 8 ++++---- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/automation/service/workflow_converter.go b/automation/service/workflow_converter.go index 30d2ed2a8c..3fb55b5c37 100644 --- a/automation/service/workflow_converter.go +++ b/automation/service/workflow_converter.go @@ -203,16 +203,16 @@ func (svc workflowConverter) workflowStepDefConv(g *wfexec.Graph, s *types.Workf } }() - if err == nil && conv == nil { + if err != nil { + return false, err + } else if conv != nil { + conv.SetID(s.ID) + g.AddStep(conv) + return true, err + } else { // signal caller that we were unable to // resolve definition at the moment return false, nil - } else { - if conv != nil { - conv.SetID(s.ID) - g.AddStep(conv) - } - return err == nil, err } } @@ -276,9 +276,6 @@ func (svc workflowConverter) convGateway(g *wfexec.Graph, s *types.WorkflowStep, } } - // return empty struct even if we get an error, - // so step definitions converted into workflow.Step instances - // and this step don't go through verification more than one time if s.Ref == "excl" { return wfexec.ExclGateway(pp...) } else { diff --git a/pkg/wfexec/gateways.go b/pkg/wfexec/gateways.go index cb14149e5d..4f5b999565 100644 --- a/pkg/wfexec/gateways.go +++ b/pkg/wfexec/gateways.go @@ -100,12 +100,12 @@ type inclGateway struct { // InclGateway fn initializes inclusive gateway func InclGateway(pp ...*GatewayPath) (*inclGateway, error) { if len(pp) < 2 { - return &inclGateway{}, fmt.Errorf("expecting at least two paths for incusive gateway") + return nil, fmt.Errorf("expecting at least two paths for incusive gateway") } for _, p := range pp { if p.test == nil { - return &inclGateway{}, fmt.Errorf("all inclusve gateway paths must have valid test Expression") + return nil, fmt.Errorf("all inclusve gateway paths must have valid test Expression") } } @@ -142,12 +142,12 @@ type exclGateway struct { func ExclGateway(pp ...*GatewayPath) (*exclGateway, error) { t := len(pp) if t < 2 { - return &exclGateway{}, fmt.Errorf("expecting at least two paths for exclusive gateway") + return nil, fmt.Errorf("expecting at least two paths for exclusive gateway") } for i, p := range pp { if p.test == nil && i != t-1 { - return &exclGateway{}, fmt.Errorf("all exclusive gateway paths must have valid test Expression") + return nil, fmt.Errorf("all exclusive gateway paths must have valid test Expression") } }