CircleCI-Public / ruby-orb

The `circleci/ruby` orb source code.
https://circleci.com/developer/orbs/orb/circleci/ruby
MIT License
25 stars 53 forks source link

Cannot cache gems if we use `install-deps` with `path` parameter #19

Closed Kuchitama closed 4 years ago

Kuchitama commented 4 years ago

Orb Version 0.2.2

Describe the bug Cannot save cache when install-deps is called with path parameter.

To Reproduce

  1. Call install-deps with specific path
  2. Call save-cache
  3. Call load-cache

Expected behavior

Save cache with specific path

Additional context

lokst commented 4 years ago

@Kuchitama Thanks for reporting this. Just to clarify, are you setting path to a non-default value?

KyleTryon commented 4 years ago

I have located the problem and will resolve as a part of the next major update (coming shortly, will update)

olleolleolle commented 4 years ago

For reference save-cache has:

      paths:
        - vendor/bundle

but load-cache does not.

Workaround

This snippet from a working configuration file of mine shows how to do without the load-cache step (until it is repaired):

      # Because of this Issue: https://github.com/CircleCI-Public/ruby-orb/issues/19, manually re-implement this step
      #- ruby/load-cache
      - restore_cache:
          keys:
            - 'gems-v1-{{ checksum "Gemfile.lock" }}'
          paths:
            - vendor/bundle
KyleTryon commented 4 years ago

Hello,

Version 1.0.0 of the Ruby orb has been released.

https://github.com/CircleCI-Public/ruby-orb/releases/tag/v1.0.0 https://circleci.com/orbs/registry/orb/circleci/ruby?version=1.0.0

@olleolleolle I am not actually sure I fully understood the issue you presented. The save_cache step determines what path to cache. The load-cache step will download that cached path and place it directly into the same location, for this reason, it does not need its own path parameter.

Please try updating for us to the new 1.0.0 release and let us know if you continue to experience any issue.

kevinluo201 commented 4 years ago

I'm using

orbs:
  ruby: circleci/ruby@1.0 
  node: circleci/node@2

and build project by

 - ruby/install-deps:
          bundler-version: 1.17.3
      - node/install-packages:
          pkg-manager: yarn
          cache-key: "yarn.lock"

It doesn't cache