How to kill an heroku build that is in progress?
Asked Answered
S

3

67

I accidentally pushed a build that does an npm install in the postinstall script. This has led to my heroku app being stuck in an infinite install loop. I searched the heroku documentation on how to kill builds but came up blank. The closest thing I found was https://help.heroku.com/Z44Q4WW4/how-do-i-stop-a-release-phase and I tried killing as per those instructions but my build won't die :(

Seafarer answered 21/6, 2018 at 14:18 Comment(0)
R
65

The heroku-builds CLI plugin (heroku plugins:install heroku-builds) has a command which will stop a running build:

$ heroku builds:cancel -a your-app-name

All builds will time out too after a time that can go between 15 minutes to 1 hour.

Reuven answered 21/6, 2018 at 14:36 Comment(3)
this workd but one needs to heroku plugins:install heroku-builds before, just like explained here https://mcmap.net/q/293393/-how-to-kill-an-heroku-build-that-is-in-progressIndogermanic
what if app is a review app?Malnourished
Review apps are apps like any other, with their app name being the part of the hostname before .herokuapp.com. So you can kill them exactly the same way.Reuven
A
98

If you have a build going into production right now and need to stop it quickly:

heroku plugins:install heroku-builds
heroku builds:cancel -a YOUR_HEROKU_APP_NAME
Acicula answered 4/7, 2019 at 17:53 Comment(3)
Perfect - I needed that quick cancel!Berkeley
This is so amazing! fast and clean.Majolica
Once you are logged in, just heroku builds:cancel should do it - for the most recent 🏃🏾‍♂️ build at least.Jello
R
65

The heroku-builds CLI plugin (heroku plugins:install heroku-builds) has a command which will stop a running build:

$ heroku builds:cancel -a your-app-name

All builds will time out too after a time that can go between 15 minutes to 1 hour.

Reuven answered 21/6, 2018 at 14:36 Comment(3)
this workd but one needs to heroku plugins:install heroku-builds before, just like explained here https://mcmap.net/q/293393/-how-to-kill-an-heroku-build-that-is-in-progressIndogermanic
what if app is a review app?Malnourished
Review apps are apps like any other, with their app name being the part of the hostname before .herokuapp.com. So you can kill them exactly the same way.Reuven
A
39

To view all builds run the following in your terminal:

heroku builds -a YOUR_APP_NAME

To cancel a specific (pending) build:

heroku builds:cancel -a YOUR_APP_NAME HEROKU_BUILD_ID

Update (4th July 2020):

If you see the message Warning: builds is not a heroku command, run heroku plugins:install heroku-builds and try again.

Anodic answered 24/11, 2019 at 12:55 Comment(1)
Arguably the best answer since it lets you cancel a specific buildArgon

© 2022 - 2024 — McMap. All rights reserved.