-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Better support for govaluate expressions #4153
Comments
We use https://github.com/antonmedv/expr for evaluation in Meanwhile, as a workaround I can suggest you add a new container step right before the relevant |
Yeah, will test it and add my findings in this ticket. Ad) workaround - yes this would be another option. However being able to use regexp would make the |
I found that if you wrap the left and right expressions with single quotes respectively, the error will go away. For example, for when: "a11 =~ a1\\d+" the working version would be when: "'a11' =~ 'a1\\d+'" |
I came here as I was confused as to whether To me it is very confusing to find |
Looks like Our use case:
It was working fine while we used Argo version: |
We're moving away from |
See #7831 and related issues for moving away from |
Summary
I found out that Argo is using
govaluate
to parsewhen
conditional expressions. I played around with it and turns out most of govaluate works out of the box. However, the regex comparison operator seems to be very flaky with all the yaml parsing (json mapping) etc stuff. I compiled a list of some expressions and their respective outcome, belowwhen: "a11 =~ a1\\d"
when 'a11 =~ a1\d
when: "a11 =~ a1\\d+"
Invalid 'when' expression 'a11 =~ a1\d+': Unexpected end of expression
when: "a11 =~ a1\\\\d"
works
"a112 =~ a\\\\d{3}"
when: "'a112 =~ a\\\\d{3}'"
Expected boolean evaluation for ''a112 =~ a\\d{3}''. Got a112 =~ a\d{3}
when: "\"a112 =~ a\\\\d{3}\""
expected boolean evaluation for '"a112 =~ a\\d{3}"'. Got a112 =~ a\d{3}
Use Cases
When would you use this?
I would use that quite often to evaluate expression in a regex like style.
Message from the maintainers:
Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.
The text was updated successfully, but these errors were encountered: