falcondev-oss / github-actions-cache-server

Self-hosted GitHub Actions cache server implementation. Compatible with official 'actions/cache' action
https://gha-cache-server.falcondev.io
MIT License
131 stars 10 forks source link

Upload fails from docker action #42

Closed joh-klein closed 4 months ago

joh-klein commented 4 months ago

Worfklow setup (after I got it to work in #41):

- name: Set up Docker Buildx
  uses: docker/setup-buildx-action@v3
  with:
    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

At the start of the step, I can see this in the logs from the cache server:

[cache-server] ⚙ No exact primary matches found
[cache-server] ⚙ No restore keys provided
[cache-server] ⚙ Get: No cache entry found for [ 'index-buildkit-1-f921bd05' ] 693bb7016429d80366022f036f84856888c9f13e00145f5f6f4dce303a38d6f2
[cache-server] ⚙ Get: Getting cache entry for [ 'buildkit-blob-1-sha256:0d0c16747d2c6b6c26c064652afcb964c15f1b1e596ec052b2aa19b83948ae27' ] 693bb7016429d80366022f036f84856888c9f13e00145f5f6f4dce303a38d6f2
[cache-server] ⚙ Finding key match { key:
   'buildkit-blob-1-sha256:0d0c16747d2c6b6c26c064652afcb964c15f1b1e596ec052b2aa19b83948ae27',
  version: '693bb7016429d80366022f036f84856888c9f13e00145f5f6f4dce303a38d6f2',
  restoreKeys: undefined }

At the end of the docker build step, the cache upload fails with:

#16 exporting to GitHub Actions Cache
#16 preparing build cache for export
#16 preparing build cache for export 0.1s 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

I don't know (yet) how to get more meaningful output

LouisHaftmann commented 4 months ago

Does retrying the run with debug logs enabled show anything useful?

joh-klein commented 4 months ago

Nope. Could find anything. Also adding buildkitd-flags: --debug to the Setup-Action didn't show anything different

joh-klein commented 4 months ago

I will temporarily go back to the original gha cache to see, if it has anything to do with the kubernetes driver and setup (the cache worked before in k8s but I didn't switch to the k8s driver then). It would be super cool if there was a way to switch to the original cache without rebuilding the runner image …

joh-klein commented 4 months ago

The "OG" cache doesn't have the problem:

#15 exporting to GitHub Actions Cache
#15 preparing build cache for export
#15 writing layer sha256:32d9857c4f4835a493d21463dcc7e498a59bdb44ac621f2ffa10f2bf825246c5
#15 writing layer sha256:32d9857c4f4835a493d21463dcc7e498a59bdb44ac621f2ffa10f2bf825246c5 2.3s done
#15 writing layer sha256:7c65fb70bae1fc6a6df9187fb36d80d39ffa9e4a89597418d78a086004a83ed7
#15 writing layer sha256:7c65fb70bae1fc6a6df9187fb36d80d39ffa9e4a89597418d78a086004a83ed7 0.3s done
#15 writing layer sha256:c21ce77c4b0c7b34e732f4d19fa0c5b00dda745586f3946cbbc64666ddaab3f3
#15 writing layer sha256:c21ce77c4b0c7b34e732f4d19fa0c5b00dda745586f3946cbbc64666ddaab3f3 0.3s done
#15 writing layer sha256:f0513f0e14e7c79ed978751b5310e20be390ed51ce00163514198b291ef8d200
#15 writing layer sha256:f0513f0e14e7c79ed978751b5310e20be390ed51ce00163514198b291ef8d200 0.3s done
#15 preparing build cache for export 5.1s done
#15 DONE 5.1s
joh-klein commented 4 months ago

Is there more log output from your side I can activate? Maybe the cache server doesn't accept the blobs correctly …

LouisHaftmann commented 4 months ago

I'll look into it

LouisHaftmann commented 4 months ago

Fixed in https://github.com/falcondev-oss/github-actions-cache-server/releases/tag/v2.1.8

joh-klein commented 4 months ago

Thank you for fixing it so quickly!