Bundler caching with Git Gems


#1

Hi,

I’m running into issue where bundler gems are not being cached with project that has Git Gems. For every rebuild, it does a full bundle install. Basically, during bundle check, it will always find a Git Gem source that it can’t find installed. For example:

bundle check || bundle install
https://github.com/alexcavalli/bing-ads-api.git (at cfd1d77@cfd1d77) is not yet 
checked out. Run `bundle install` first.

Gemfile entry:

gem 'bing-ads-api', git: 'https://github.com/alexcavalli/bing-ads-api.git', ref: 'cfd1d77'

Here is my config.yml

version: 2
jobs:
  build:
    parallelism: 4
    docker:
      - image: circleci/ruby:2.4.3-stretch
        environment:
          RAILS_ENV: test
          BUNDLE_JOBS: 3
          BUNDLE_RETRY: 3
          BUNDLE_PATH: vendor/bundle
          PGHOST: 127.0.0.1
          PGUSER: root
      - image: redis:4.0.2
      - image: circleci/postgres:9.6
        environment:
          POSTGRES_USER: root
          POSTGRES_DB: circle-test_test

    steps:

    - restore_cache:
        keys:
          - source-v1-{{ .Branch }}-{{ .Revision }}
          - source-v1-{{ .Branch }}-
          - source-v1-

    - checkout

    - save_cache:
        key: source-v1-{{ .Branch }}-{{ .Revision }}
        paths:
          - ".git"

    - run: sudo apt-get update
    - run: sudo apt-get install postgresql-client-9.6
    - run: gem install bundler

    - run:
        name:  Bundler Version
        command: bundle -v

    - restore_cache:
        keys:
          - gem-cache-v1-{{ checksum "Gemfile.lock" }}
          - gem-cache-v1-

    - run:
        name: Bundle Install
        command: bundle check || bundle install

    - save_cache:
        key: gem-cache-v1-{{ checksum "Gemfile.lock" }}
        paths:
            - vendor/bundle
    - run:
        name: Waiting for Postgres to start
        command: dockerize -wait tcp://localhost:5432 -timeout 1m

    - run:
        name: Waiting for Redis to start
        command: dockerize -wait tcp://localhost:6379 -timeout 1m

    - run:
        name: Database Setup
        command: |
          bundle exec rake db:create
          bundle exec rake db:structure:load

    - run:
        name: Run rspec
        command: bundle exec rspec spec --format progress

#2

This is now resolved. Changed the save_cache key and worked next run.


#3

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.