Hi I am working in github actions and kubernetes. I am building multiple docker images using matrix as below.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ matrix.docker-image-name }}
flavor: latest=true
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
- name: Build and push Docker image ${{ matrix.name }}
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ${{matrix.context }}
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
This piece of code always build and pushes the image with latest tag. This code is working but i do not want to tag image with latest rather i would like to tag with github sha. So tired something like this
tags: ${{ github.sha }}
Whenever I add above code my code started failing and throwing the error
buildx call failed with: ERROR: denied: requested access to the resource is denied
I want to push image with sha can someone pls help me to fix this. Any help would be appreciated. Thanks