how I upgraded to rails 6 using gitenvs

2019-11-20 02:05:41 UTC

preface

the goal was to upgrade a production app from rails 4 to rails 6 in phases, slowing taking over workers and endpoints. this meant i had rails 4 and rails 6 in production in parallel. in a perfect world, the master branch would freeze, you could take your time deploying rails 6, and everything is hunky dory. too bad we don't live in the real world, and the master branch is always moving, regardless on how much you plan for it.

the gitenvs environment

i utilized gitenvs to constantly maintain a production-rails6 environment

rails 6 environment config in gitenvs

the configuration above in layman's terms:

  • the environment should be built on top of the master branch
  • the environment branch is production-rails6
  • do not automatically deploy when changes were found

adding rails 6 branches

i added two branches to the environment, which were rails6.0-stable and rails6.0-config.

  • rails6.0-stable was the rails 6 upgrade
  • rails6.0-config had custom configuration that i didn't want to commit into the rails6.0-stable

gitenvs status of production-rails6

the screenshot above was created by using the slack integration, and inputting the command /gitenvs status production-rails6

outcome

as the developer(s) pushed changes to rails6.0-stable, gitenvs would build and push the production-rails6 environment by merging the rails6.0-stable, and rails6.0-config on top of master

gitenvs production rails 6 git tree

deployment

once the branch production-rails6 was built, the ci (bitbucket pipelines) ran the specs, and deployed the code

rails 6 bitbucket pipelines