Is it possible to abort on errors or call another task when a command fails?
This doesn't work:
@task('migrate', ['on' => 'web'])
cd {{ $currentReleaseDir }};
php artisan migrate || exit 1;
@endtask
It fails with the message (I know I can run --force
, it's just a way to make the command fail for testing):
**************************************
* Application In Production! *
**************************************
But then it proceeds to run the rest of the deploy script.
Yes, you can use:
@error
echo $task;
exit; /*Or Do any other processing*/
@enderror
this outputs
<?php $__container->error(function($task) {
echo $task;
exit; /*Or Do any other processing*/
}); ?>
This is listed in the compiler functions here https://github.com/laravel/envoy/blob/master/src/Compiler.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With