-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GHA export fails with "Cache already exists" #2325
Comments
Could be relevant but can't tell without repro. Would suggest to define cache-from: type=gha,scope=${{ matrix.name }}-cache
cache-to: type=gha,scope=${{ matrix.name }}-cache,mode=max |
@crazy-max thanks for the response. We had to disable caching for now since all the builds were failing, but could you provide more info on what the scope does? I couldn't find much in the docs. Should I have a different scope for every image that I build? Like if one of the images in the matrix is built in a previous step too, do I need the same scope for caching to work? |
https://github.com/moby/buildkit#github-actions-cache-experimental
If you talk about this workflow, release-docker:
name: Release Images
runs-on: ubuntu-20.04
needs: [binary]
strategy:
matrix:
include:
- scope: nginx-ingress
tags: |
nginx/nginx-ingress:${{ needs.binary.outputs.version }}
nginx/nginx-ingress:latest
type: debian
platforms: linux/arm,linux/arm64,linux/amd64,linux/ppc64le,linux/s390x
- scope: nginx-ingress-alpine
tags: |
nginx/nginx-ingress:${{ needs.binary.outputs.version }}-alpine
nginx/nginx-ingress:alpine
type: alpine
platforms: linux/arm,linux/arm64,linux/amd64,linux/ppc64le,linux/s390x
- scope: nginx-ingress-ubi
tags: |
nginx/nginx-ingress:${{ needs.binary.outputs.version }}-ubi
nginx/nginx-ingress:ubi
type: ubi
platforms: linux/arm64,linux/amd64
steps:
- name: Checkout Repository
uses: actions/checkout@v2
...
- name: Push to Dockerhub
uses: docker/build-push-action@v2
with:
file: build/Dockerfile
context: '.'
cache-from: type=gha,scope=${{ matrix.scope }}
cache-to: type=gha,scope=${{ matrix.scope }},mode=max
target: goreleaser
tags: ${{ matrix.tags }}
platforms: ${{ matrix.platforms }}
push: true
build-args: |
BUILD_OS=${{ matrix.type }}
IC_VERSION=${GITHUB_REF#refs/tags/}
NGINX_VERSION=${{ steps.commit.outputs.nginx_version }}
DATE=${{ steps.commit.outputs.date }}
GIT_COMMIT=${{ github.sha }} |
Similar problem. It's build without matrix. Scope already used.
env:
SERVICE_NAME: web ... - name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1 ... - name: Build image
uses: docker/build-push-action@v2
id: docker_build
with:
context: web
builder: ${{ steps.buildx.outputs.name }}
file: ./web/Dockerfile
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=gha,scope=${{ env.SERVICE_NAME }}
cache-to: type=gha,scope=${{ env.SERVICE_NAME }},mode=max The error is:
I noticed |
I tried adding the scope but I still get
Seems like the scope is not used? |
Have the same issue, scope is set but does not seem to be used:
|
The workflow is using the following in a matrix (not sure if it's relevant)
and sometimes I get this
I tried searching for the sha in the other builds in the matrix, but couldn't find it, I'm assuming it's from a previous run?
The text was updated successfully, but these errors were encountered: