Skip to content

Commit

Permalink
docs: retry docs improvement (#8794)
Browse files Browse the repository at this point in the history
* docs: fix retryStrategy.expression in comments

Signed-off-by: John Lin <johnlinp@gmail.com>

* docs: add a description to mark OnFailure as the default for retryPolicy

Signed-off-by: John Lin <johnlinp@gmail.com>

* docs: retryStrategy.expression overrides retryStrategy.retryPolicy

Signed-off-by: John Lin <johnlinp@gmail.com>
  • Loading branch information
johnlinp committed May 18, 2022
1 parent 088d139 commit 231b907
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion docs/retries.md
Expand Up @@ -27,7 +27,7 @@ spec:
Use `retryPolicy` to choose which failures to retry:

- `Always`: Retry all failed steps
- `OnFailure`: Retry steps whose main container is marked as failed in Kubernetes
- `OnFailure`: Retry steps whose main container is marked as failed in Kubernetes (this is the default)
- `OnError`: Retry steps that encounter Argo controller errors, or whose init or wait containers fail
- `OnTransientError`: Retry steps that encounter errors [defined as transient](https://github.com/argoproj/argo-workflows/blob/master/util/errors/errors.go), or errors matching the `TRANSIENT_ERROR_PATTERN` [environment variable](https://argoproj.github.io/argo-workflows/environment-variables/). Available in version 3.0 and later.

Expand Down Expand Up @@ -66,6 +66,8 @@ access to the following variables:

If `expression` evaluates to false, the step will not be retried.

Note that when `expression` is specified, `retryPolicy` will be ignored.

See [example](https://raw.githubusercontent.com/argoproj/argo-workflows/master/examples/retry-conditional.yaml) for usage.

## Back-Off
Expand Down
2 changes: 1 addition & 1 deletion examples/retry-conditional.yaml
@@ -1,4 +1,4 @@
# Only retry if the retryStrategy.when condition is satisfied. In this example, retries will be made until a pod has
# Only retry if the retryStrategy.expression condition is satisfied. In this example, retries will be made until a pod has
# exit code 2 or the limit of 10 is reached, whichever happens first.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
Expand Down
2 changes: 1 addition & 1 deletion workflow/controller/operator_test.go
Expand Up @@ -7545,7 +7545,7 @@ status:
startedAt: "2021-06-10T22:28:49Z"
`

// TestOperatorRetryExpression tests that retryStrategy.when works correctly. In this test, the latest child node has
// TestOperatorRetryExpression tests that retryStrategy.expression works correctly. In this test, the latest child node has
// just failed with exit code 2. The retryStrategy's when condition specifies that retries must only be done when the
// last exit code is NOT 2. We expect the retryStrategy to fail (even though it has 8 tries remainng).
func TestOperatorRetryExpression(t *testing.T) {
Expand Down

0 comments on commit 231b907

Please sign in to comment.