buildkit-cache-dance icon indicating copy to clipboard operation
buildkit-cache-dance copied to clipboard

Support Glob Injection/Extraction

Open JakeCooper opened this issue 1 year ago • 2 comments

I'm attempting to load a cache I know exists into a cache mount

      - name: Cache All node_modules folders
        uses: actions/cache@v3
        with:
          path: ${{ github.workspace }}/**/node_modules
          key: ${{ runner.os }}-node_modules-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
          restore-keys: |
            ${{ runner.os }}-node_modules-${{ env.cache-name }}-
            ${{ runner.os }}-node_modules-
            ${{ runner.io }}-

I know the above works because the output of the pnpm install is as follows

Run pnpm install --frozen-lockfile --prefer-offline
Scope: all 11 workspace projects
Lockfile is up to date, resolution step is skipped
Packages: +3757
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

. postinstall$ rm -rf node_modules/@types/react-native
. postinstall: Done
Done in 3.4s

I've tried something as follows but it doesn't seem to mount correctly?

 - name: Load pnpm cache into Docker Container
    uses: reproducible-containers/[email protected]
     with:
         cache-source: ${{ runner.os }}-pnpm-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
          cache-target: /mono/**/node_modules
RUN --mount=type=cache,id=pnpm,target=/mono pnpm install --prod --frozen-lockfile

But alas no luck. Any pointers?

JakeCooper avatar Dec 08 '23 06:12 JakeCooper

I assume the glob mount is messing things up here....

JakeCooper avatar Dec 08 '23 06:12 JakeCooper

What will cache-target: /mono/**/node_modules mean?

AkihiroSuda avatar Dec 11 '23 09:12 AkihiroSuda