【问题标题】:How to auto-upgrade a gem in travis?如何在 travis 中自动升级宝石?
【发布时间】:2018-08-03 13:33:21
【问题描述】:

我帮助维护 an open source project,Hyrax,它是一个 Rails 引擎。为了对新开发进行 QA,我们维护了an application that is specifically for QA,Nurax,它应该始终使用最新的 Rails 引擎大师进行更新。我已经在Gemfile 中为 Nurax 指定了 Hyrax 的主分支,如果我运行bundle update hyrax,它确实会获得最新的主版本并相应地更新Gemfile.lock。我还可以通过 Travis 让 Nurax 自动部署。但是,在部署之前,自动部署不会自动更新到 Hyrax 的最新 master,这是我真正想要发生的。

最好的设置方法是什么?我是否应该让 travis 运行 bundle update hyrax 并将更改提交给 Nurax master 作为其构建的一部分?我发现了一些关于从 travis 构建提交的主题(例如,this one)。为每个 PR 创建一个新的 Nurax 分支并部署该分支会更好吗?有没有我可以遵循的既定模式?

非常感谢任何建议。

【问题讨论】:

  • 我认为你在正确的轨道上:...让 travis 运行 bundle update hyrax 并将更改提交给 Nurax master 作为其构建的一部分...

标签: ruby-on-rails travis-ci continuous-deployment rails-engines


【解决方案1】:

我最终通过 cron 作业解决了这个问题。我在我的ubuntu 用户的主目录中检查了相关服务器上代码的本地副本。然后,我将ubuntu 用户的 ssh 密钥添加到我自己的 github 帐户以及用于 capistrano 部署的帐户中。然后,我将其设置为每天运行:

#!/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}"`

【讨论】:

    猜你喜欢
    • 2012-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-17
    • 1970-01-01
    • 1970-01-01
    • 2013-03-06
    相关资源
    最近更新 更多