heroku / cli

Heroku CLI
https://devcenter.heroku.com/articles/heroku-cli
ISC License
855 stars 224 forks source link

heroku ps:wait supporting failing startup of application #1732

Open ebendal opened 3 years ago

ebendal commented 3 years ago

Do you want to request a feature or report a bug?

Feature

What is the current behavior?

https://github.com/heroku/cli/blob/master/packages/ps/src/commands/ps/wait.ts

heroku ps:wait is made to wait for a deployment to be up and running. A literal quote from the code:

static description = 'wait for all dynos to be running latest version after a release'

I tested it with a successful deployment and it exited the process with status 0 as soon as my dyno was in the state up. So far so good.

But now I wanted to test a failing startup of the application I was deploying. So introduced a bug so the app did not want to start. To my surprise it was in an infinite loop. The state of the of the dyno was changed from starting to crashed. And Heroku tried another time. So crashed became starting and it failed again so now crashed was the final state of this version of the application. And the heroku ps:wait process was still running.

What is the expected behavior?

I expect the heroku ps:wait command to exit the process with an error status if the app it is waiting for becomes in the state crashed. Also a timeout as parameter would be great (with a default of 60 seconds or some sorts).

This is very useful for automated deployment. After deploying an app it should be possible to find out with the Heroku CLI to know whether the startup of the app succeeded.

nertzy commented 5 months ago

It would be great to support a --timeout [number of seconds] flag or similar.

Until then, I've been able to simulate the same thing with a call to timeout from coreutils.