I am trying to push docker container to Artifact Registry on GCP but I got an error on step Push Docker Image to Artifact Registry
denied: Permission "artifactregistry.repositories.uploadArtifacts" denied on resource "projects/PROJECT_ID/locations/asia-south1/repositories/images" (or it may not exist) Error: Process completed with exit code 1.
name: Build image and push to Artifact Registry of GCP
on:
push:
branches:
- master
jobs:
build-push-artifact:
name : Build and push Artifact Registry
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.ACCOUNT_KEY }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
- name: 'Use gcloud CLI'
run: 'gcloud info'
- name: build Docker Image
run: docker build -t MY_IMAGE:latest .
- name: Configure Docker Client of Gcloud
run: |-
gcloud auth configure-docker --quiet
gcloud auth configure-docker asia-south1-docker.pkg.dev --quiet
- name: Push Docker Image to Artifact Registry
env:
GIT_TAG: v0.1.0
run: |-
docker tag MY_IMAGE:latest asia-south1-docker.pkg.dev/PROJECT_ID/images/MY_IMAGE:latest
docker tag MY_IMAGE:latest asia-south1-docker.pkg.dev/PROJECT_ID/images/MY_IMAGE:$GIT_TAG
docker push asia-south1-docker.pkg.dev/PROJECT_ID/images/MY_IMAGE:latest
docker push asia-south1-docker.pkg.dev/PROJECT_ID/images/MY_IMAGE:$GIT_TAG
I also added the Artifact Registry Write principal to repository with service email.Every other step execute successfully except last one. How can I fix it?