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

tar error during post job cleanup

Open dataviruset opened this issue 5 months ago • 3 comments

On a self-hosted runner, arm64 macOS, Docker Desktop installed.

      - name: Build package cache
        id: cache
        uses: actions/cache@v4
        with:
          path: pnpm-store
          key: pnpm-store-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
      - name: Metro cache
        id: metro-cache
        uses: actions/cache@v4
        with:
          path: metro-cache
          key: metro-cache-${{ runner.os }}-${{ inputs.image_name }}
      - name: inject cache
        uses: reproducible-containers/buildkit-cache-dance@v3
        with:
          cache-map: |
            {
              "pnpm-store": "/pnpm/store",
              "metro-cache": "/app/${{ inputs.app_dir }}/node_modules/.cache"
            }
          skip-extraction: ${{ steps.cache.outputs.cache-hit }}
Post job cleanup.

FROM ghcr.io/containerd/busybox:latest
COPY buildstamp buildstamp
RUN --mount=type=cache,target=/pnpm/store     mkdir -p /var/dance-cache/     && cp -p -R /pnpm/store/. /var/dance-cache/ || true

tar: Must specify one of -c, -r, -t, -u, -x
Error: process exited with code 1
    at ChildProcess.<anonymous> (file:///Users/redacted/actions-runner3/_work/_actions/reproducible-containers/buildkit-cache-dance/v3/dist/index.js:7129:36)
    at ChildProcess.emit (node:events:524:28)
    at maybeClose (node:internal/child_process:1104:16)
    at ChildProcess._handle.onexit (node:internal/child_process:304:5)
Error: process exited with code 1
    at ChildProcess.<anonymous> (file:///Users/redacted/actions-runner3/_work/_actions/reproducible-containers/buildkit-cache-dance/v3/dist/index.js:7129:36)
    at ChildProcess.emit (node:events:524:28)
    at maybeClose (node:internal/child_process:1104:16)
    at ChildProcess._handle.onexit (node:internal/child_process:304:5)

Could it be that something changed in the latest busybox to make the tar command stop working?

dataviruset avatar Jun 12 '25 11:06 dataviruset

It requires the GNU version of tar, so if you running the action on a self hosted runner or local container, you need to make sure that the correct version of tar is installed

barrydobson avatar Jun 17 '25 14:06 barrydobson

It requires the GNU version of tar, so if you running the action on a self hosted runner or local container, you need to make sure that the correct version of tar is installed

Interesting, I guess the busybox output before tar is a red herring then and the tar command actually runs in macOS and not in Linux (BusyBox in Docker). I will try to install GNU tar in macOS and set it as the default tar. I didn't look into this but unless there are any specific GNU features used maybe it would be nice if the action supported both.

dataviruset avatar Jun 17 '25 14:06 dataviruset

The busybox part is just an output of the dockerfile the action used to copy the directories around and out of/in to the containers. The other instructions such as tar are ran on the host

barrydobson avatar Jun 17 '25 14:06 barrydobson