为什么这个 Travis 部署到 Heroku 会失败?

Why does this Travis deploy to Heroku fail?

我使用 Travis CI 构建了一个 Ruby 应用程序。成功构建后,该应用程序将部署到 Heroku。从 Cedar 升级到 Cedar-14 并将 Ruby 版本更改为 2.1.4(因为这是堆栈升级所必需的)后,部署步骤在 Heroku 预编译项目时失败。我尝试了各种部署策略但没有成功。日志未指定无效的 url,这使得很难跟踪解决此问题。来自部署日志:

运行:耙子assets:precompile 耙子中止!

参数错误:无效url

/tmp/build_4345603424563456/vendor/bundle/ruby/2.1.0/gems/redis-3.0.7/lib/redis/client.rb:364:in `_parse_options'

当我将应用程序直接推送到 Github 时,部署成功并且堆栈升级到 Cedar-14。

那么,为什么在使用 Travis 时 Heroku 部署步骤突然失败 CI?

此问题已通过显式将 url 传递给 Redis 初始化构造函数而不是使用 'old' 传递已解析符号的方式解决。旧方法似乎最适用于 Rails 4 之前的版本(如果不是唯一的话)。Heroku 上的 Redis To Go 文档证实了这一点:Redis To Go

Rails 4

REDIS = Redis.new(:url => redis_url_string)

前Rails 4

uri = URI.parse(redis_url)
REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)

对于另一个类似的问题,请参阅此 post: