Skip to content

Commit

Permalink
Revert "Fixes Wf duplicate issues for gateway steps"
Browse files Browse the repository at this point in the history
This reverts commit d4bf6fc.
  • Loading branch information
tjerman committed Oct 8, 2021
1 parent 1567472 commit 859aec3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
17 changes: 7 additions & 10 deletions automation/service/workflow_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions pkg/wfexec/gateways.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down Expand Up @@ -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")
}
}

Expand Down

0 comments on commit 859aec3

Please sign in to comment.