Skip to content

Commit

Permalink
fix: remove err handling in hook
Browse files Browse the repository at this point in the history
Signed-off-by: isubasinghe <isitha@pipekit.io>
  • Loading branch information
isubasinghe committed Aug 1, 2023
1 parent 34691e6 commit 92a903e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions workflow/controller/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
func (woc *wfOperationCtx) executeWfLifeCycleHook(ctx context.Context, tmplCtx *templateresolution.Context) (bool, error) {
var hookNodes []*wfv1.NodeStatus
for hookName, hook := range woc.execWf.Spec.Hooks {
//exit hook will be executed in runOnExitNode
// exit hook will be executed in runOnExitNode
if hookName == wfv1.ExitLifecycleEvent {
continue
}
Expand Down Expand Up @@ -56,16 +56,13 @@ func (woc *wfOperationCtx) executeWfLifeCycleHook(ctx context.Context, tmplCtx *
func (woc *wfOperationCtx) executeTmplLifeCycleHook(ctx context.Context, scope *wfScope, lifeCycleHooks wfv1.LifecycleHooks, parentNode *wfv1.NodeStatus, boundaryID string, tmplCtx *templateresolution.Context, prefix string) (bool, error) {
var hookNodes []*wfv1.NodeStatus
for hookName, hook := range lifeCycleHooks {
//exit hook will be executed in runOnExitNode
// exit hook will be executed in runOnExitNode
if hookName == wfv1.ExitLifecycleEvent {
continue
}
hookNodeName := generateLifeHookNodeName(parentNode.Name, string(hookName))
// To check a node was triggered
hookedNode, err := woc.wf.GetNodeByName(hookNodeName)
if err != nil {
return false, err
}
hookedNode, _ := woc.wf.GetNodeByName(hookNodeName)
if hook.Expression == "" {
return false, errors.Errorf(errors.CodeBadRequest, "Expression required for hook %s", hookNodeName)
}
Expand Down

0 comments on commit 92a903e

Please sign in to comment.