我正在尝试使用简单的构建脚本(如下)为我的GitLab Rails项目设置一个简单的测试阶段,但出现错误:
bundler: failed to load command: rspec (/usr/local/bundle/bin/rspec)
Bundler::LockfileError: You must use Bundler 2 or greater with this lockfile.
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/lockfile_parser.rb:108:in `warn_for_outdated_bundler_version'
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/lockfile_parser.rb:95:in `initialize'
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/definition.rb:72:in `new'
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/definition.rb:72:in `initialize'
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/dsl.rb:200:in `new'
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/dsl.rb:200:in `to_definition'
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/dsl.rb:12:in `evaluate'
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/definition.rb:33:in `build'
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler.rb:128:in `definition'
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler.rb:94:in `setup'
/usr/local/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/setup.rb:20:in `<top (required)>'
/usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
我收到此错误消息是因为他们在其构建中使用捆绑程序bundler-1.14.6
,并且我的Gemfile锁已与捆绑程序2.0.2捆绑在一起。有没有一种方法可以在GitLab构建上安装所需的Bundle版本?
这是我的简单测试工作(取自GitLab文档)。
image: "ruby:2.4.0"
before_script:
- apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs
- ruby -v
- which ruby
- gem install bundler --no-document
- bundle install --jobs $(nproc) "${FLAGS[@]}"
rspec:
script:
- bundle exec rspec
P.S。我已经注册了GitLab论坛,但他们从未激活我的帐户,这就是为什么我在这里发布问题。
答案 0 :(得分:0)
如果您正在使用容器注册表,则一种可能性是下载docker映像,请使用:
docker exec -itd container bash # look it up, can't check syntax right now
然后在容器内执行升级,接下来将是docker commit和tag(也进行查找),然后在gitlab上更新容器注册表