I am running the google-github-actions/deploy-cloudrun Action on Github, which fails when trying to push a docker image to Artifact Registry.
Google Artifact Registry
fails with name invalid: Missing image name. Pushes should be of the form docker push HOST-NAME/PROJECT-ID/REPOSITORY/IMAGE
Github action YML
# Authenticate Docker to Google Cloud Artifact Registry
- name: Docker Auth
id: docker-auth
uses: 'docker/login-action@v1'
with:
username: 'oauth2accesstoken'
password: '${{ steps.auth.outputs.access_token }}'
registry: '${{ env.GAR_LOCATION }}-docker.pkg.dev'
- name: Build and Push Container
run: |-
docker build -t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}" .
docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}"
Log output
Successfully built 2edd636b95c7
Successfully tagged us-central1-docker.pkg.dev/[my-project]/github-actions:ecb28fdf92addae09fe6bd9e86033027b2850de3
The push refers to repository [us-central1-docker.pkg.dev/[my-project]/github-actions]
8189f048f482: Retrying in 5 seconds
... multiple retries ...
name invalid: Missing image name. Pushes should be of the form docker push HOST-NAME/PROJECT-ID/REPOSITORY/IMAGE
Error: Process completed with exit code 1.
I do have Artifact Registry enabled, and created repository with the path us-central1-docker.pkg.dev/[my-project]/github-actions
The IAM role has following permissions
I am out of ideas why to the authenticated docker it appears that the registry doesn't exist.
Turns out, the above notation is only specifying HOST-NAME/PROJECT-ID/REPOSITORY:tag
but not /IMAGE
Replacing all occurrences by e.g. ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/website:${{ github.sha }}
will use /website
as the actual image name within the repository.