如何停止正在进行的 Heroku 部署

How to stop deployment to Heroku in progress

是否可以停止对当前正在构建的 Heroku (git push heroku) 的部署?

类似于heroku run stopit!

顺便说一句。成功部署后回滚不是我想要的。

我可能已经找到了这个问题的答案,它似乎已经在五月份由 Heroku 回答了。我假设 release phase 他们的意思是 deployhttps://help.heroku.com/Z44Q4WW4/how-do-i-stop-a-release-phase

Release Phase processes are the same as any other Dyno in your formation, expect they run the codebase from the new release, instead of your current release.

To monitor your Release Phase processes as they execute, you can use the CLI command heroku ps -a YOUR_APP_NAME. as these are normal processes, you can use the ps:kill and ps:scale commands to stop the Release Phase from completing, which in turn, will prevent the latest release from completing.

我还没有测试过这个,但是当我测试完后我会更新我的确切命令。如果有人对此进行了测试并可以确认,请随时更新此答案。

首先,安装 Heroku builds plugin:

heroku plugins:install heroku-builds

然后,要取消构建,请获取最近构建的列表:

heroku builds -a YOUR_APP_NAME

输出的第一行将是您当前 运行 构建,第一列是构建 ID。

取消:

heroku builds:cancel BUILD_ID -a YOUR_APP_NAME

Et voilà,这将强制构建失败。

注意:您还可以从构建日志中获取构建 ID URL。

我用了命令

heroku builds:cancel -a <your_app_name>

这对我有用