Issue
I help to maintain an open source project, Hyrax, which is a rails engine. In order to do QA on new development, we maintain an application that is specifically for QA, Nurax, which should always be updated with the latest master of the rails engine. I have specified the master branch of Hyrax in the Gemfile
for Nurax, and if I run bundle update hyrax
it will indeed get the latest master version and update the Gemfile.lock
accordingly. I can also get Nurax to deploy automatically via Travis. However, that auto-deploy does not automatically update to the latest master of Hyrax before deploying, which is what I really want to happen.
What is the best way to set this up? Should I have travis run a bundle update hyrax
and commit that change to Nurax master as part of its build? I've found a few topics about committing from a travis build (e.g., this one). Would it be better to make a new Nurax branch for each PR and deploy that branch? Is there an established pattern for this that I could be following?
Any advice greatly appreciated.
Solution
I ended up solving this with a cron job. I checked out a local copy of the code on the server in question, in the home directory of my ubuntu
user. I then added the ubuntu
user's ssh key to my own github account, and to the account used for capistrano deploy. Then, I set this up to run daily:
#!/usr/local/bin/ruby
# Get the latest nurax master
# Make a branch with today's date and update hyrax
# Push and deploy that branch
today = Time.now.strftime('%Y-%m-%e-%H-%M')
`cd /home/ubuntu/nurax; git checkout master; git pull; git checkout -b "#{today}"`
`cd /home/ubuntu/nurax; bundle update hyrax`
`cd /home/ubuntu/nurax; git commit -a -m 'Daily update for "#{today}"'; git push --set-upstream origin #{today}`
`cd /home/ubuntu/nurax; BRANCH_NAME="#{today}" cap nurax-dev deploy`
`cd /home/ubuntu/nurax; git checkout master; git branch -d "#{today}"; git push origin --delete "#{today}"`
Answered By - bess Answer Checked By - Cary Denson (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.