-
-
Notifications
You must be signed in to change notification settings - Fork 634
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
Allow precondition to skip with warning in addition to failing. #1991
Comments
@simonrouse9461 Correct me if I'm wrong, but this sounds like the same functionality that would be provided by an |
@pd93 Yes, I'm just looking for a way to do conditional logics in task. |
@simonrouse9461 how sophisticated is your problem? You can in many cases use a simple bash IF statement in either your precondition or task commands. And toggle that behaviour with an environment variable (I did not test this, but I do similar things so I know it works):
Run task this way:
preconditions and if statements are the same thing, clearly. EDIT: @simonrouse9461 also, you can do the same thing with the task templating ... which might be more comfortable than the bash syntax. For example I do this type of thing often:
and that type of thing also works for sh commands. |
@trulede Yeah, this is the workaround I'm using right now. But the syntax is cumbersome and doesn't give too much flexibility. Especially when the logic grows too complicated, relying on conditionals in the templating syntax makes it unreadable and hard to maintain. |
Description
Currently, a task will fail if any of the preconditions fails. It will be very helpful to allow a task to skip conditionally without failing.
Proposal:
$a != 1
, the task will fail by default.$b != 2
, the task will skip with a warning "Skip!".$c != 3
, the task will fail with message "Fail!".$b != 2
and$c != 3
, the task will skip instead of failing.The text was updated successfully, but these errors were encountered: