Skip to content

Commit

Permalink
fix: multi-platform docker build cache misses due to overwriting othe…
Browse files Browse the repository at this point in the history
…r platforms
  • Loading branch information
lklimek committed Nov 25, 2024
1 parent 0928f49 commit f7ffa9a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/actions/docker/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ runs:
region: ${{ inputs.cache_region }}
bucket: ${{ inputs.cache_bucket }}
endpoint: ${{ inputs.cache_endpoint }}
prefix: "cache-layers/${{ inputs.platform }}/"
cache_to_name: ${{ inputs.cache_to_name }}

- name: Set HOME variable to github context
Expand Down Expand Up @@ -160,6 +161,7 @@ runs:
endpoint: ${{ inputs.cache_endpoint }}
access_key_id: ${{ inputs.cache_access_key_id }}
secret_access_key: ${{ inputs.cache_secret_access_key }}
platform: ${{ inputs.platform }}
install: false

- name: Build and push Docker image ${{ inputs.image }}
Expand Down
5 changes: 4 additions & 1 deletion .github/actions/sccache/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ inputs:
secret_access_key:
description: S3 endpoint secret access key
required: true
platform:
description: "Platform and architecture to use when caching; helps to avoid invalid cache on different arch"
required: true
install:
description: "Install sccache"
default: "true"
Expand Down Expand Up @@ -50,6 +53,6 @@ runs:
echo "SCCACHE_BUCKET=${{ inputs.bucket }}" >> $GITHUB_ENV
echo "SCCACHE_REGION=${{ inputs.region }}" >> $GITHUB_ENV
echo "SCCACHE_ENDPOINT=${{ inputs.endpoint }}" >> $GITHUB_ENV
echo "SCCACHE_S3_KEY_PREFIX=${{ runner.os }}/sccache/${{ runner.arch }}/linux-gnu" >> $GITHUB_ENV
echo "SCCACHE_S3_KEY_PREFIX=${{ runner.os }}/sccache/${{ inputs.platform }}/" >> $GITHUB_ENV
# "SCCACHE_VERSION" is used inside Docker to install the same version of sccache
echo "SCCACHE_VERSION=${{ inputs.version }}" >> $GITHUB_ENV

0 comments on commit f7ffa9a

Please sign in to comment.