听起来您的 Envoy 脚本在migrate-db
任务中有错误。如果不发布代码,就很难判断该任务发生了什么。我建议echo
在任务中使用一个简单的方法来让脚本首先完成。
跑envoy run deploy --env=staging
@servers(['web' => '127.0.0.1'])
@setup
$env = isset($env) ? $env : "localhost";
$host = gethostname();
$hook = "https://hooks.slack.com/services/XXX";
$channel = "#your-channel";
@endsetup
@story('deploy')
migrate-db
@endstory
@task('migrate-db')
echo 'migrate-db'
@endtask
@error
@slack($hook, $channel, "Deploy failed on [$env], hostname: $host");
echo "Deploy failed on [$env], hostname: $host\r\n";
@enderror
@finished
@slack($hook, $channel, "Deploy succeeded on [$env], hostname: $host");
echo "Deploy succeeded on [$env], hostname: $host\r\n";
@endfinished