deployment - Deploy once a specific branch with capistrano? -


we have simple branching strategy:

  • develop -> development branch
  • staging -> staging server deploy branch
  • master -> productio branch

our production deploy workflow develop -> staging -> master. deploy first staging, test time, , deploy production.

right we're working in new feature test. don't want put in staging because, since experimental, not lock production deploy until feature finished.

is there way capistrano branch want 1 particular deploy, put experimental code in staging test it?

obs: reason need put in staging piece of code depends on lot of external resources configured in staging , difficult replicate locally.

here's how it.

at top of config/deploy/staging.rb file, put this:

set :branch, env.fetch("capistrano_branch", "staging") 

this tells capistrano when run cap staging deploy, use staging branch default, allow overridden capistrano_branch environment variable.

so if want deploy custom branch staging, simple this:

capistrano_branch=my-feature cap staging deploy 

Comments