Skip to content

Commit

Permalink
fix(controller): step group stuck on running when exit hook has inval…
Browse files Browse the repository at this point in the history
…id expression

Signed-off-by: joey <[email protected]>
  • Loading branch information
chengjoey committed Dec 26, 2024
1 parent 27a5938 commit 7851bd2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
11 changes: 11 additions & 0 deletions util/expr/argoexpr/eval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ func TestEvalBool(t *testing.T) {
want: true,
wantErr: false,
},
{
name: "test null expression",
args: args{
input: "steps[\"prepare\"].outputs != null",
env: map[string]interface{}{"steps": map[string]interface{}{
"prepare": map[string]interface{}{"outputs": "msg"},
}},
},
want: false,
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
6 changes: 4 additions & 2 deletions workflow/controller/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,10 @@ func (woc *wfOperationCtx) executeStepGroup(ctx context.Context, stepGroup []wfv
completed = false
} else if childNode.Completed() {
hasOnExitNode, onExitNode, err := woc.runOnExitNode(ctx, step.GetExitHook(woc.execWf.Spec.Arguments), childNode, stepsCtx.boundaryID, stepsCtx.tmplCtx, "steps."+step.Name, stepsCtx.scope)
if hasOnExitNode && (onExitNode == nil || !onExitNode.Fulfilled() || err != nil) {
// The onExit node is either not complete or has errored out, return.
if err != nil {
return node, err
}
if hasOnExitNode && (onExitNode == nil || !onExitNode.Fulfilled()) {
completed = false
}
}
Expand Down

0 comments on commit 7851bd2

Please sign in to comment.