Status Check Functions in conditionals
Proposed Feature
This is a follow up to https://github.com/akuity/kargo/issues/3125.
We added conditionals, but would now like the ability to run steps based on status conditions (e.g. always, or upon failure).
GitHub Actions solves this by re-using their if clause with Status Check Functions.
Examples:
if: ${{ success() }}
if: ${{ always() }}
if: ${{ cancelled() }}
if: ${{ failure() }}
At first I felt reusing the if clause for this purpose seemed a bit too magical and preferred this to be in a separate field. From docs:
A default status check of success() is applied unless you include one of these functions
However, after thinking about this more, having it in the if clause has advantages over introducing it into another field because it can be mixed with other checks. e.g.:
if: ${{ failure() && steps.demo.conclusion == 'failure' }}
So I am in favor of GitHub's approach to this.
Motivation
This would be useful in things like notification steps
Suggested Implementation
Introduce status check functions understood in the if clause.
Alternative/related proposals:
- https://github.com/akuity/kargo/issues/2972
- https://github.com/akuity/kargo/issues/3228
I would happily close #3228 in favor of this approach.
Hey all - is the proposal here to solve rollback scenarios with this too? Case I'm thinking about is -
- Promote to Stage A (git clone, commit, push; argo-update)
- Run Verification Steps(metrics check, qa test run)
- A Test Fails causing failed verification
- Run a step to redo step one with the previous freight as input - effectively a rollback
is the proposal here to solve rollback scenarios with this too?
No, https://github.com/akuity/kargo/issues/2972 would be the issue to follow, which could automatically trigger a roll back in the case of verification failure.