Skip to content

Failed cache restore should not lead to failed step #225

@mblaschke-daimlertruck

Description

@mblaschke-daimlertruck

Contributing guidelines

I've found a bug, and:

  • The documentation does not mention anything about my problem
  • There are no open or closed issues that are related to my problem

Description

Sometimes the cache seems to be broken(?) or something went wrong with the cache which results in an failed docker/setup-qemu-action@v3 step on self-hosted runners (based on ghcr.io/actions/actions-runner and docker:dind as sidecar running in Kubernetes).

Clearing binfmt cache entry solves the situation but it's just a workaround.

Expected behaviour

broken cache should not lead to failed step/job

Actual behaviour

step fails and job is broken

Repository URL

No response

Workflow run URL

No response

YAML workflow

build:
    runs-on: ...
    needs: [lint]
    defaults:
      run:
        working-directory: app/
    steps:
      - name: Checkout
        uses: actions/checkout@v5

      - name: Azure Login
        uses: azure/login@v2
        with:
          creds: ${{ secrets.xxx }}

      - name: ACR login
        shell: bash
        run: |
            az acr login --name xxx

      - name: Setup go
        uses: actions/setup-go@v5
        with:
          go-version-file: app/go.mod
          cache-dependency-path: app/go.sum
          check-latest: true

      - name: Golang vendor
        run: |
          go mod vendor

      - name: Docker meta
        id: docker_meta
        uses: docker/metadata-action@v5
        with:
          images: xxxx.azurecr.io/app
          tags: |
            # ...

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Build
        uses: docker/build-push-action@v6
        with:
          context: app/
          push: true
          platforms: linux/amd64,linux/arm64
          tags: ${{ steps.docker_meta.outputs.tags }}
          labels: ${{ steps.docker_meta.outputs.labels }}
          cache-from: type=gha
          cache-to: type=gha,mode=max

Workflow logs

Pulling binfmt Docker image
  Cache hit for: docker.io--tonistiigi--binfmt-latest-linux-x64
  Received 4194304 of 31033862 (13.5%), 4.0 MBs/sec
  Received 31033862 of 31033862 (100.0%), 20.2 MBs/sec
  Cache Size: ~30 MB (31033862 B)
  /usr/bin/tar -xf /home/runner/_work/_temp/2eb78645-2081-4053-a1df-683a35a64b59/cache.tzst -P -C /home/runner/_work/runtime-mgmt/runtime-mgmt --use-compress-program unzstd
  Cache restored successfully
  Restored docker.io--tonistiigi--binfmt-latest-linux-x64 from GitHub Actions cache
  Cached to hosted tool cache /opt/hostedtoolcache/docker.io--tonistiigi--binfmt/latest/linux-x64
Error: ENOENT: no such file or directory, copyfile '/opt/hostedtoolcache/docker.io--tonistiigi--binfmt/latest/linux-x64/image.tar' -> '/home/runner/.docker/.cache/images/docker.io--tonistiigi--binfmt/latest/linux-x64/image.tar'

BuildKit logs


Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions