Trigger Travis launches after deploying Heroku

I have an Integrationtests group on Travis that I need to run after my Ruby on Rails application has been deployed to Heroku. How can i do this?

I tried using the HTTP POST method, but Travis required custom headers and JSON bodies, and Heroku does not support both . Is there another way?

+7
ruby-on-rails heroku travis-ci
source share
1 answer

I can imagine a couple of solutions, but no one is perfect.

One: you can create a simple application that translates the usual Heroku deployment hook into a format acceptable to Travis. Of course, you need to place it somewhere, but this is a great option for Amazon Lambda or a similar solution. If you ever wanted to try making a server without a server, I think you have the perfect case. And the cost of hosting will be almost nothing.

Two: you can use the release phase on Heroku. Create a script bin/notify-travis , and this is in the file Procfile release: bin/notify-travis . The problem is how to get all the information about the deployed code, like commit sha. To do this, you can enable the lab function called dyno-metadata . It will introduce additional configuration variables, one is HEROKU_SLUG_COMMIT , which contains commit sha. If more data is required, this solution may not work. Make sure bin/notify-travis returns 0. It will be launched just before deployment. And if it fails, your code will not be deployed.

Three: you can find or write your own collector who will send web chat to Travis. The problem is that it will work during the build phase. In case of errors, your code cannot be deployed, but you will send a webhook. And it can also be problematic to get all the necessary information about the assembly, as in solution two.

So you have a few options. I guess the first one is the best, but it may not meet your other requirements.

+1
source share

All Articles