小编Man*_*nez的帖子

如何在Gitlab CI中为rails项目使用缓存?

我一直在尝试利用Gitlab Ci的缓存为我的ruby on rails应用程序,但到目前为止还没有运气,我的应用程序是使用共享运行程序,也许这就是问题?

这是我的内容 .gitlab-ci.yml

services:
  - postgres:latest

rspec:
  stage: test
  script:
    - apt-get update -qy
    - apt-get install -y nodejs
    - gem install bundler
    - bundle check --path vendor/bundle || bundle install --path vendor/bundle --jobs $(nproc)
    - cp config/database.gitlab-ci.yml config/database.yml
    - RAILS_ENV=test bundle exec rake db:create db:schema:load
    - bundle exec rspec
  cache:
    paths:
      - vendor/bundle
  tags:
    - ruby
    - postgres
Run Code Online (Sandbox Code Playgroud)

当我的测试运行时,我确实看到跑步者检查缓存内容,但它从未恢复它:

gitlab-ci-multi-runner 1.1.3 (a470667)
Using Docker executor with image ruby:2.1 ...
Pulling docker image postgres:latest ...
Starting service …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails bundler gitlab gitlab-ci

10
推荐指数
1
解决办法
2507
查看次数

标签 统计

bundler ×1

gitlab ×1

gitlab-ci ×1

ruby-on-rails ×1