Skip to content

Preconditions fail even if condition was met #597

@sylv-io

Description

@sylv-io
  • Task version: master branch (6a0b778)
  • Operating System: Arch Linux

A fail of a precondition causes all future preconditions to fail too, even if the condition is met.

Example Taskfile showing the issue

tasks: default: deps: - subtask cmds: - task: check vars: ID: 1 BOOL: true - task: check vars: ID: 2 BOOL: false - cmd: "echo DONE" silent: true subtask: deps: - task: check vars: ID: 3 BOOL: true - task: check vars: ID: 4 BOOL: false - task: check vars: ID: 5 BOOL: true - task: check vars: ID: 6 BOOL: false - pass - fail check: #run: when_changed run: always preconditions: - sh: '{{.BOOL}}' msg: "[{{.ID}}]: {{.BOOL}}" pass: run: always preconditions: - sh: 'true' msg: "precondition should never fail" fail: run: always preconditions: - sh: 'false' msg: "precondition should fail"

Expected output

No precondition, where BOOL=true should fail:

task: precondition should fail task: [6]: false task: [4]: false task: precondition not met exit status 1 

Actual output

task: precondition should fail task: [3]: true task: [5]: true task: [6]: false task: [4]: false task: precondition should never fail task: precondition not met exit status 1 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions