Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Preconditions to Tasks #205

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clarify difference between status and precondition in docs
  • Loading branch information
stephenprater committed May 28, 2019
commit 12ab01d5e62528ae3923284921efed0a6d033856
20 changes: 11 additions & 9 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,30 +365,32 @@ tasks:
```

Preconditions can set specific failure messages that can tell
a user what to do using the `msg` field.
a user what steps to take using the `msg` field.

If a task has a dependency on a sub-task with a precondition, and that
precondition is not met - the calling task will fail. Adding `ignore_errors`
to the precondition will cause parent tasks to execute even if the sub task
can not run. Note that a task executed directly with a failing precondition
will not run unless `--force` is given.
precondition is not met - the calling task will fail. Note that a task
executed with a failing precondition will not run unless `--force` is
given.

Unlike `status` which will skip a task if it is up to date, and continue
executing tasks that depenend on it a `precondition` will fail a task, along
andreynering marked this conversation as resolved.
Show resolved Hide resolved
with any other tasks that depend on it.

```yaml
version: '2'
tasks:
task_will_fail:
preconditions:
- sh: "exit 1"
ignore_errors: true

task_will_succeed:
task_will_also_fail:
deps:
- task_will_fail
andreynering marked this conversation as resolved.
Show resolved Hide resolved

task_will_succeed:
task_will_still_fail:
cmds:
- task: task_will_fail
- echo "I will run"
- echo "I will not run"
andreynering marked this conversation as resolved.
Show resolved Hide resolved
```

## Variables
Expand Down