Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Generate useful error message when no expression on hook #10919

Merged
merged 2 commits into from
May 1, 2023

Conversation

Joibel
Copy link
Member

@Joibel Joibel commented Apr 14, 2023

The error message for a missing or empty expression was unable to evaluate expression '': unexpected token EOF (1:1). This changes it to a more useful Expression required for hook <hook path>.

Also attempt to validate to prevent this problem upfront.

Fixes #10910

Copy link
Member

@terrytangyuan terrytangyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this ready for review?

@Joibel
Copy link
Member Author

Joibel commented Apr 23, 2023

Not yet, the validator isn't quite done.

@Joibel Joibel force-pushed the hook-expressions branch 3 times, most recently from 7de2e80 to cb27c36 Compare April 27, 2023 21:14
The error message for a missing or empty expression was `unable to
evaluate expression '': unexpected token EOF (1:1)`. This changes it
to a more useful `Expression required for hook <hook path>`.

Also attempt to validate to prevent this problem upfront.

Signed-off-by: Alan Clucas <alan@clucas.org>
@Joibel Joibel marked this pull request as ready for review April 28, 2023 07:45
@@ -18,12 +19,15 @@ func (woc *wfOperationCtx) executeWfLifeCycleHook(ctx context.Context, tmplCtx *
if hookName == wfv1.ExitLifecycleEvent {
continue
}
hookNodeName := generateLifeHookNodeName(woc.wf.ObjectMeta.Name, string(hookName))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed until inside the execute block?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use it on new line 24, two lines below this one as part of the error message.

@terrytangyuan terrytangyuan merged commit f2573ed into argoproj:master May 1, 2023
23 checks passed
terrytangyuan pushed a commit that referenced this pull request May 25, 2023
@Joibel Joibel deleted the hook-expressions branch May 28, 2023 18:25
JPZ13 pushed a commit to pipekit/argo-workflows that referenced this pull request Jul 4, 2023
dpadhiar pushed a commit to dpadhiar/argo-workflows that referenced this pull request May 9, 2024
…oj#10919)

Signed-off-by: Alan Clucas <alan@clucas.org>
Signed-off-by: Dillen Padhiar <dillen_padhiar@intuit.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

An empty/missing expression in a non exit LifecycleHook produces a cryptic error message
2 participants