如何修复Gitlab CI

时间:2019-07-23 12:57:13

标签: ruby-on-rails ruby gitlab gitlab-ci

我正在尝试为Gitlab CI设置pronto,在本地一切正常,但是当pronto在Gitlab CI上运行时,“ Rugged :: ReferenceError:revspec'origin / master'not found / not found / master'not found”出现错误

cache:
  paths:
    - vendor/

services:
  - name: mysql:8.0
    command: ["mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--default-authentication-plugin=mysql_native_password"]

variables:
  MYSQL_DATABASE: $MYSQL_DATABASE
  MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PASSWORD
  DB_USERNAME: $DB_USERNAME
  DB_HOST: $DB_HOST
  DISABLE_SPRING: 1


before_script:
  - cp config/database.yml.example config/database.yml
  - apt-get update -qq && apt-get install -y -qq cmake
  - gem install bundler --no-document
  - bundle check || bundle install --path vendor --jobs $(nproc)  "${FLAGS[@]}"

spec:
  script:
    - bundle exec rspec

pronto:
  script:
    - bundle exec pronto run -c origin/master --exit-code

Rugged::ReferenceError: revspec 'origin/master' not found
  vendor/ruby/2.6.0/gems/pronto-0.10.0/lib/pronto/git/repository.rb:87:in `merge_base'
  vendor/ruby/2.6.0/gems/pronto-0.10.0/lib/pronto/git/repository.rb:87:in `merge_base'
  vendor/ruby/2.6.0/gems/pronto-0.10.0/lib/pronto/git/repository.rb:17:in `diff'
  vendor/ruby/2.6.0/gems/pronto-0.10.0/lib/pronto.rb:62:in `run'
  vendor/ruby/2.6.0/gems/pronto-0.10.0/lib/pronto/cli.rb:66:in `block in run'
  vendor/ruby/2.6.0/gems/pronto-0.10.0/lib/pronto/cli.rb:64:in `chdir'
  vendor/ruby/2.6.0/gems/pronto-0.10.0/lib/pronto/cli.rb:64:in `run'
  vendor/ruby/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
  vendor/ruby/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
  vendor/ruby/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
  vendor/ruby/2.6.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
  vendor/ruby/2.6.0/gems/pronto-0.10.0/bin/pronto:6:in `<top (required)>'
  vendor/ruby/2.6.0/bin/pronto:23:in `load'
  vendor/ruby/2.6.0/bin/pronto:23:in `<top (required)>'

我希望在gitlab上运行pronto而不会出现异常

1 个答案:

答案 0 :(得分:1)

我不知道这是否是最好的解决方案,但这对我有用:

  • 在您的gitlab存储库中,转到设置-> CI / CD
  • 在“常规管道->管道的Git策略”部分中,标记选项git clone而不是git fetch git clone

  • 我还必须在git fetch调用上方添加一个pronto命令:

pronto:
  script:
    - git fetch
    - bundle exec pronto run -c origin/master --exit-code