I have my master
branch that is used to deploy to a staging server. And I have my stable
branch that is used to deploy to the production server. The capistrano script I use is setup this way.
Current workflow:
Whenever there is an issue with production, I branch out from stable
branch, fix things up, commit it, merge it with stable
and then deploy to production.
This gives no chance for me to test that bug fix (happened in that hot fix branch), in my staging server. Ideally what I want would be:
Wanted workflow:
Whenever there is an issue with production, I branch out from stable
branch, fix things up, commit it, merge it with master
, deploy and test that fix in staging server, validate if it works, then merge that hot fix branch to stable
and deploy it the production.
How do I get this right with Capistrano? Please help.
Create a new branch with the branch, switch or checkout commands. Perform a git push with the –set-upstream option to set the remote repo for the new branch. Continue to perform Git commits locally on the new branch. Simply use a git push origin command on subsequent pushes of the new branch to the remote repo.
If you are not developing a gem, but simply using Capistrano to deploy an application: Your deployment will be unique to your particular project, based on a combination of various Capistrano gems, configuration, server environment, etc. The only real way to test your deployment is by using a staging environment.
Disclaimer: Forgive me if i've misunderstood your question, but i think you've already answered you own question.
Your Git workflow is just that, your 'git workflow'. Doesn't really have anything to do with Capistrano. Capistrano will fetch whatever you want it to, it's up to you how you want to merge and branch your repo to get it to the point of deployment.
From what you said i'm assuming you have your cap stages setup already to deploy the right branch, but if you don't there is an example below. This will fetch the different branch for each type of deploy.
deploy.rb
set :stages, %w(staging production)
set :default_stage, "staging"
deploy/staging.rb #cap deploy
set :branch, 'master'
deploy/production.rb #cap production deploy
set :branch, 'stable'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With