kestra-io / kestra

:zap: Workflow Automation Platform. Orchestrate & Schedule code in any language, run anywhere, 500+ plugins. Alternative to Zapier, Rundeck, Camunda, Airflow...
https://kestra.io
Apache License 2.0
13.1k stars 1.15k forks source link

waitFor exits when nested task is marked as a Warning #6031

Open janorga opened 1 day ago

janorga commented 1 day ago

Describe the issue

WaitFor loop exits when a nested task in the loop exits with a Warning status, no matter the "waitfor" condition:

You can test it with:

id: myflow
namespace: mynamespace
tasks:
  - id: loop
    type: io.kestra.plugin.core.flow.WaitFor
    condition: "{{ outputs.check_migration_task.vars['status'] == 'FINISHED' }}"
    failOnMaxReached: true
    checkFrequency: 
      interval: PT5S
      maxDuration: PT135M
    tasks:

     ## forcing a Warning
    - id: allow_failure
      type: io.kestra.plugin.scripts.shell.Commands
      taskRunner:
        type: io.kestra.plugin.core.runner.Process
      allowFailure: true
      commands:
        - exit 1

    - id: check_migration_task
      type: io.kestra.plugin.scripts.shell.Commands
      taskRunner:
        type: io.kestra.plugin.scripts.runner.docker.Docker
        entryPoint: []
      containerImage: "ubuntu:latest"
      commands:
        - "echo '::{\"outputs\":{\"status\": \"INPROGRESS\"}}::'"

Expected behavior

WaitFor should only auto-exit on Failure status on a nested task but not with other status for a nested task. So a Warning in a nested task should keep on with the loop and evaluating the "waitfor" condition

Environment