Fix buildx caching

This commit is contained in:
Ingo Oppermann
2024-02-21 11:30:02 +01:00
parent 3d81776720
commit 5c33864ff9

View File

@@ -21,11 +21,13 @@ jobs:
golang: golang:1.22-alpine3.19 golang: golang:1.22-alpine3.19
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
branch: vod branch: vod
key: alpine3.19
- os: alpine - os: alpine
os_version: "3.16" os_version: "3.16"
golang: golang:1.19-alpine3.16 golang: golang:1.19-alpine3.16
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
branch: vod branch: vod
key: alpine3.16
steps: steps:
- name: Checkout - name: Checkout
@@ -54,7 +56,7 @@ jobs:
- name: Cache Docker layers - name: Cache Docker layers
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: ${{ env.cachedir }} path: ${{ env.cachedir }}-${{ matrix.key }}
key: ${{ runner.os }}-buildx-${{ github.sha }} key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: | restore-keys: |
${{ runner.os }}-buildx- ${{ runner.os }}-buildx-
@@ -79,12 +81,12 @@ jobs:
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=${{ env.cachedir }} cache-from: type=local,src=${{ env.cachedir }}-${{ matrix.key }}
cache-to: type=local,dest=${{ env.cachedir }}-new,mode=max cache-to: type=local,dest=${{ env.cachedir }}-${{ matrix.key }}-new,mode=max
- # Temp fix - # Temp fix
# https://github.com/docker/build-push-action/issues/252 # https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896 # https://github.com/moby/buildkit/issues/1896
name: Move cache name: Move cache
run: | run: |
rm -rf ${{ env.cachedir }} rm -rf ${{ env.cachedir }}-${{ matrix.key }}
mv ${{ env.cachedir }}-new ${{ env.cachedir }} mv ${{ env.cachedir }}-${{ matrix.key }}-new ${{ env.cachedir }}-${{ matrix.key }}