reproducible-containers / buildkit-cache-dance

Save `RUN --mount=type=cache` caches on GitHub Actions ( Forked from https://github.com/overmindtech/buildkit-cache-dance )
Apache License 2.0
97 stars 24 forks source link

Stored cache is empty #33

Open sylver opened 2 weeks ago

sylver commented 2 weeks ago

I am probably missing something, but doing the same as the example results in an empty cache :

      - name: Cache apk
        uses: actions/cache@v4
        id: cache-apk
        with:
          path: |
            var-cache-apk
          key: ${{ runner.os }}-apk-cache-${{ hashFiles('Dockerfile') }}
          save-always: true
          restore-keys: |
            ${{ runner.os }}-apk-cache-

      - name: Inject apk cache into Docker
        uses: reproducible-containers/buildkit-cache-dance@v3.1.1
        with:
          cache-map: |
            {
              "var-cache-apk": {
                "target": "/var/cache/apk",
                "id": "apk-cache"
              }
            }
          save-always: true
          skip-extraction: ${{ steps.cache-apk.outputs.cache-hit }}
Screenshot 2024-06-02 at 18 18 38

Dockerfile snippet using this cache :

RUN --mount=type=cache,id=apk-cache,target=/var/cache/apk \
<<EOT
set -e

echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories

apk update
apk upgrade
apk add ${PACKAGES}
EOT

I have the same issue with other caches I tried (pnpm store, build dist folders, etc), so that's not related specifically to this path but to the way I implement the action (according to the documentation).

yunhaoww commented 4 days ago

same here.