feat: allow last retry variables in expressions. Fixes #10364#14450
feat: allow last retry variables in expressions. Fixes #10364#14450Joibel merged 21 commits intoargoproj:mainfrom
Conversation
Signed-off-by: eduardodbr <eduardodbr@hotmail.com>
Signed-off-by: eduardodbr <eduardodbr@hotmail.com>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
util/template/expression_template.go
Outdated
| return fmt.Fprintf(w, "{{%s%s}}", kindExpression, expression) | ||
| } | ||
|
|
||
| if (hasVariableInExpression(unmarshalledExpression, "lastRetry.exitCode") && !hasVarInEnv(env, "lastRetry.exitCode") || |
There was a problem hiding this comment.
Oh, this hack is horrid. But it mirrors what's happening with retries, so I guess we go with it for now.
Can we make this less evil code wise - perhaps list of all the variables we're going to do this for and iterate? Including retry?
There was a problem hiding this comment.
Sure I think we can do this for lastRetry but I do not want to do this for retries. I think they need to be distinct.
I could maybe be refactored to share some common logic though.
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
|
Thanks for resurrecting it! Looks good to me. Did you have the time to check @juliev0 suggestion? #12722 (comment) |
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
Signed-off-by: isubasinghe <isitha@pipekit.io>
|
❌ Cherry-pick failed for 3.6. Please check the workflow logs for details. |
Co-authored-by: eduardodbr <eduardodbr@hotmail.com> (cherry picked from commit 81130fb) Signed-off-by: eduardodbr <eduardodbr@hotmail.com> Signed-off-by: isubasinghe <isitha@pipekit.io> Signed-off-by: Alan Clucas <alan@clucas.org>
|
Oops, this is a feature so shouldn't be back ported. I was trying to sort out the dependencies for backporting #15033 to release-3.6 |
Fixes #10364
Motivation
This PR resurrects the older PR by @eduardodbr to support last retry variable in expressions.
Modifications
This adds a generic function to replace expressions. My change differs somewhat to @eduardodbr's. I didn't agree with his implementation so I changed it. The actual injection is pretty much exactly how retries get injected.
Verification
Verified with the test.
Documentation
Modified the docs to add documentation on the
lastRetryvariable.