3

I have a rails app that runs database migrations in a rake task after tests have succeeded and immediately before deploying code to Heroku.

I am using CodeShip to run the tests, run the migrations, and then finally deploy to heroku.

However, I am running into a problem with Heroku's new Pipelines feature.

Upon promoting a version of my app from one environment to another, only the the application slug is copied over to the new environment. No branches are merged or updated in git, and no codeship builds trigger.

Even the heroku build history shows only a promotion entry with no build log associated. Which makes sense since it is just copying the slug over, not building a new slug.

enter image description here

So my problem is that when I promote my app to a new environment, I am not able to find any way of hooking a custom script into that event to perform database migrations.

Main Question

Is there support for this that I am just having trouble finding? If not, is a feature in the works that would support this?

Feature Suggestion

Ideally I would like the promotion feature to work by merging the underlying git branches, that way codeship could still kick off, run all tests and migrations again in the new environment, and then finally trigger the build in the next environment. This would require each environment in the pipeline to be tied to a specific branch, instead of just promoting by commit hash, but I don't think that would be problematic.

Essentially I would like the promote button to just do what we developers would often do when manually promoting a version of our app, merge to a git branch associated with that environment and let our CI server's git hooks kick it off from there.

Michael
  • 1,535
  • 2
  • 17
  • 32
  • I know you've asked this a long time ago but just came across this as I faced the same issue today: https://devcenter.heroku.com/articles/pipelines#can-i-run-scripts-such-as-rake-db-migrate-when-promoting. What gives me hope they will fix it is the part where it reads "not, not at this time". – Andre Gallo Oct 20 '16 at 16:36

1 Answers1

0

Post-promotion script can be defined in Procfile with release process type.

release: npm run migrate
Željko Šević
  • 3,743
  • 2
  • 26
  • 23