feat: add `--failfast` and `failfast: true` to control dependencies by andreynering · Pull Request #2525 · go-task/task

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we're merging all our Taskfiles into a single one, we've run into unexpected behavior with the following setup:

Main Taskfile:

version: '3'

failfast: true

includes:
    other: Taskfile2.yaml

tasks:
  default:
    deps:
      - dep1
      - dep2
      - dep3
      - dep4

  dep1: sleep 1 && echo 'dep1'
  dep2: sleep 2 && echo 'dep2'
  dep3: sleep 3 && echo 'dep3'
  dep4: exit 1

Included Taskfile:

version: '3'

failfast: false

tasks:
  default:
    deps:
      - dep1
      - dep2
      - dep3
      - dep4

  dep1: sleep 1 && echo 'dep1'
  dep2: sleep 2 && echo 'dep2'
  dep3: sleep 3 && echo 'dep3'
  dep4: exit 1

When running task, I expect failfast to be enabled, but when running task other:default, I expect failfast to be disabled. Currently, this doesn’t happen:

image

In my opinion, there are a few possible ways to address this:

  • Enforce failfast only through .taskrc for the global one, but keep the failfast for a local task
  • Disallow failfast within included Taskfiles (similar to how dotenv works).
  • Document the current behavior more clearly.