moby / buildkit

concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit
https://github.com/moby/moby/issues/34227
Apache License 2.0
8.01k stars 1.12k forks source link

Debug upload to gha cache #4961

Open joh-klein opened 3 months ago

joh-klein commented 3 months ago

I have a custom github-actions-cache setup that works great with my custom github actions runners. All are deployed in a k8s cluster. The caching of npm dependencies works flawlessly. It took me some time, but now the buildx container seems to find the cache server as well (I get the log output from the server when it tries to lookup the build). What doesn't work is the upload of buildkit blobs). I only get the error:

#16 exporting to GitHub Actions Cache
#16 preparing build cache for export
#16 preparing build cache for export 0.0s done
#16 writing layer sha256:0d0c16747d2c6b6c26c064652afcb964c15f1b1e596ec052b2aa19b83948ae27 done
#16 ERROR: error writing layer blob: Error
------
 > exporting to GitHub Actions Cache:
------
ERROR: failed to solve: error writing layer blob: Error
Error: buildx failed with: ERROR: failed to solve: error writing layer blob: Error

The relevant parts of my workflow:

- name: Set up Docker Buildx
  uses: docker/setup-buildx-action@v3
  with:
    buildkitd-flags: --debug
    driver: kubernetes

- name: Build and push
  uses: docker/build-push-action@v5
  with:
    context: .
    push: true
    tags: |
      tag1
      tag2
    cache-from: type=gha
    cache-to: type=gha,mode=max
    file: app/docker/Dockerfile
    provenance: false
    sbom: false

Is there any way to get more meaningful output from the build-push step?

tonistiigi commented 3 months ago

If you enable debug logs on buildkit you should see logs like https://github.com/tonistiigi/go-actions-cache/blob/master/cache.go#L249