question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ruby Bundler Cache not found for input keys

See original GitHub issue

Following the recommended setup for ruby bundler, the error “Cache not found for input keys” is always given, despite it saving correctly. I have tested multiple times with back to back runs, ensuring the previous run’s keys are matching, and that Gemfile.lock is not changing. Is there anything else I can use to debug?

name: 'Rspec'
on: [pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    services:
      db:
        image: postgres:11
        ports: ['5432:5432']
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
      redis:
        image: redis
        ports: ['6379:6379']
        options: --entrypoint redis-server
    steps:
      - uses: actions/checkout@v1
      - name: Setup Ruby
        uses: actions/setup-ruby@v1
        with:
          ruby-version: 2.5.7
      - uses: actions/cache@v1
        with:
          path: vendor/bundle
          key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
          restore-keys: |
            ${{ runner.os }}-gem-
      - uses: borales/actions-yarn@v2.0.0
        with:
          cmd: install
      - name: Install Bundler
        run: |
          gem install bundler
      - name: Install libpq-dev
        run: |
          sudo apt-get install libpq-dev
      - name: Install Dependencies
        run: |
          bundle config path vendor/bundle
          bundle install --jobs 4 --retry 3
      - name: Prepare DB and run tests
        run: |
          bundle exec rails db:prepare
          bundle exec rspec

image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dhadkacommented, Jan 22, 2020

In the example you gave, for a pull request, it should give read-write permissions to the feature branch (in this case it’s the pull ref, such as refs/pull/180/merge), read-only permission to the develop branch, and read-only permission to the default branch (typically master).

I’m only seeing records in the cache for the pull refs (refs/pull/179/merge, refs/pull/180/merge, …). As such, they aren’t shared. Can you please check if you have any actions getting triggered from the develop branch? If I had to guess, you probably need to also trigger the action on the push event.

I don’t think we have any detailed public docs on how the scoping works. The overall mechanism is discussed on the cache docs page (search for “scope”). Edit: Also see the restrictions for accessing a cache section.

0reactions
pkecommented, May 29, 2020

Thought I ran into the same problem here. bundle install ran every time and the cache was not used. But my problem was not the globbing, which I also changed from **/Gemfile.lock to Gemfile.lock. But the problem was that the action never completed (due to failing tests) and therefore the cache was not saved (in a post step)

Would it be possible to save the cache before post like via trigger after bundle install?

My action file contains:

- name: Set up bundler
    uses: actions/cache@v2
    with:
    path: vendor/bundle
    key: ${{ runner.os }}-gems-${{ hashFiles('Gemfile.lock') }}
    restore-keys: |
        ${{ runner.os }}-gems-
    
- name: Install Ruby dependencies
    run: |
    sudo apt-get install libpq-dev
    bundle config path vendor/bundle
    bundle install --jobs 4 --retry 3
Read more comments on GitHub >

github_iconTop Results From Across the Web

when using bundler-cache: true, no gem versions in log #105
Use the working-directory input https://github.com/ruby/setup-ruby#working-directory if the gemfile is named Gemfile and just in a different ...
Read more >
How to load Ruby gems from cache on Github Actions
You need to specify a directory path that will be cached. It's vendor/bundle in our case. You also generate a unique cache key...
Read more >
cache-playwright-linux-1.20.0" on github actions ubuntu-latest
receiving "Cache not found for input keys: cache-playwright-linux-1.20. 0" on github actions ubuntu-latest - Stack Overflow. Stack Overflow for ...
Read more >
bundle cache - Bundler
When using gems that have different packages for different platforms, Bundler supports caching of gems for other platforms where the Gemfile has been...
Read more >
Caching dependencies in Github Actions - Sarunw
Ruby - Gem. - uses: actions/cache@v1 with: path: vendor/bundle key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} restore-keys: |
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found