简体   繁体   English

ruby 版本的 Gitlab dpl 问题

[英]Gitlab dpl issue with ruby version

I have a node app that I am deploying through Gitlab.我有一个通过 Gitlab 部署的节点应用程序。 I am using docker image node:12.8.0 .我正在使用node:12.8.0 image node:12.8.0

Recently it has been failing deployment with the following error最近部署失败,出现以下错误

 $ dpl --provider=heroku --app=$HEROKU_DEVELOPMENT_APP --api-key=$HEROKU_API_KEY --skip-cleanup
 Installing deploy dependencies
 ERROR:  Error installing dpl-heroku:
     faraday requires Ruby version >= 2.4.
 Successfully installed multipart-post-2.1.1
 Successfully installed ruby2_keywords-0.0.2
 /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- dpl/provider/heroku (LoadError)
     from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
     from /var/lib/gems/2.3.0/gems/dpl-1.10.15/lib/dpl/provider.rb:93:in `rescue in block in new'
     from /var/lib/gems/2.3.0/gems/dpl-1.10.15/lib/dpl/provider.rb:68:in `block in new'
     from /var/lib/gems/2.3.0/gems/dpl-1.10.15/lib/dpl/cli.rb:41:in `fold'
     from /var/lib/gems/2.3.0/gems/dpl-1.10.15/lib/dpl/provider.rb:67:in `new'
     from /var/lib/gems/2.3.0/gems/dpl-1.10.15/lib/dpl/cli.rb:31:in `run'
     from /var/lib/gems/2.3.0/gems/dpl-1.10.15/lib/dpl/cli.rb:7:in `run'
     from /var/lib/gems/2.3.0/gems/dpl-1.10.15/bin/dpl:5:in `'
     from /usr/local/bin/dpl:22:in `load'
     from /usr/local/bin/dpl:22:in `'
 Running after_script
 00:01
 Running after script...
 $ echo "Job - $CI_JOB_NAME ended."
 Job - deploy_development ended.
 Cleaning up file based variables
 00:01
 ERROR: Job failed: exit code 1

I am unable to install Ruby2.4 through apt-get install ruby2.4 .我无法通过apt-get install ruby2.4

Any advice would be appreciated.任何意见,将不胜感激。 Thanks谢谢

I had the same problem today in Gitlab CI.我今天在 Gitlab CI 中遇到了同样的问题。

The problem is that Node uses debian stretch (version 9) by default as the base for docker images, at least in the 12.x LTS versions.问题是 Node 默认使用debian stretch(版本 9)作为 docker 镜像的基础,至少在 12.x LTS 版本中是这样。 This version of debian has Ruby 2.3.3 by default in the repositories , which is not supported by Faraday, which requires a version equal to or greater than 2.4 .这个版本的 debian在 repositories 中默认Ruby 2.3.3 , Faraday 不支持,它需要 等于或大于 2.4 的版本

What I did was use the 12.x-buster tag (notice the -buster at the end of the version tag) and in these images of docker Node uses debian buster (version 10) as a base.我所做的是使用 12.x-buster 标签(注意版本标签末尾的-buster ),并且在这些-buster镜像中,Node 使用 debian buster(版本 10)作为基础。 This version of debian has Ruby 2.5.5 repositories by default , which allows Faraday to be installed and therefore dpl for heroku works normally.这个版本的 debian默认Ruby 2.5.5 存储库,它允许安装 Faraday,因此 heroku 的 dpl 可以正常工作。

Those running into this issue on travis-ci, I was able to do it by adding a before_deploy command to specify the version of faraday to use.那些在 travis-ci 上遇到这个问题的人,我可以通过添加一个before_deploy命令来指定要使用的法拉第版本。

...
before_deploy:
  - rvm $(travis_internal_ruby) --fuzzy do ruby -S gem install faraday -v 1.8.0
deploy:
  provider: heroku
  api_key: $HEROKU_API_KEY
...

More details: https://travis-ci.community/t/heroku-deploy-fails-installing-dpl-heroku-encounters-faraday-error/12563/6?u=hallmanitor更多细节: https : //travis-ci.community/t/heroku-deploy-fails-installing-dpl-heroku-encounters-faraday-error/12563/6?u=hallmanitor

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM