Blueprints

Retry a failing task up to 4 times (allowing up to 5 attempts with up to 4 retries)

Source

yaml
id: retries
namespace: company.team

tasks:
  - id: fail_4_times
    type: io.kestra.plugin.scripts.shell.Commands
    taskRunner:
      type: io.kestra.plugin.core.runner.Process
    commands:
      - if [ "{{ taskrun.attemptsCount }}" -eq 4 ]; then exit 0; else exit 1; fi
    retry:
      type: constant
      interval: PT0.25S
      maxAttempt: 5
      maxDuration: PT1M
      warningOnRetry: false

errors:
  - id: will_never_happen
    type: io.kestra.plugin.core.debug.Return
    format: This will never be executed as retries will fix the issue

About this blueprint

The task fail_4_times will fail 4 times and will finish successfully at the 5th attempt.

Commands

Process

Return

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra