From 5c33864ff9bbe4692366852d540d8f37ca535d44 Mon Sep 17 00:00:00 2001 From: Ingo Oppermann Date: Wed, 21 Feb 2024 11:30:02 +0100 Subject: [PATCH] Fix buildx caching --- .github/workflows/build_base_matrix_vod.yaml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_base_matrix_vod.yaml b/.github/workflows/build_base_matrix_vod.yaml index a37579cb..1254b7cf 100644 --- a/.github/workflows/build_base_matrix_vod.yaml +++ b/.github/workflows/build_base_matrix_vod.yaml @@ -21,11 +21,13 @@ jobs: golang: golang:1.22-alpine3.19 platforms: linux/amd64,linux/arm64 branch: vod + key: alpine3.19 - os: alpine os_version: "3.16" golang: golang:1.19-alpine3.16 platforms: linux/amd64,linux/arm64 branch: vod + key: alpine3.16 steps: - name: Checkout @@ -54,7 +56,7 @@ jobs: - name: Cache Docker layers uses: actions/cache@v4 with: - path: ${{ env.cachedir }} + path: ${{ env.cachedir }}-${{ matrix.key }} key: ${{ runner.os }}-buildx-${{ github.sha }} restore-keys: | ${{ runner.os }}-buildx- @@ -79,12 +81,12 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=local,src=${{ env.cachedir }} - cache-to: type=local,dest=${{ env.cachedir }}-new,mode=max + cache-from: type=local,src=${{ env.cachedir }}-${{ matrix.key }} + cache-to: type=local,dest=${{ env.cachedir }}-${{ matrix.key }}-new,mode=max - # Temp fix # https://github.com/docker/build-push-action/issues/252 # https://github.com/moby/buildkit/issues/1896 name: Move cache run: | - rm -rf ${{ env.cachedir }} - mv ${{ env.cachedir }}-new ${{ env.cachedir }} + rm -rf ${{ env.cachedir }}-${{ matrix.key }} + mv ${{ env.cachedir }}-${{ matrix.key }}-new ${{ env.cachedir }}-${{ matrix.key }}