I am trying to deploy a nestjs application on a monorepo to GCD CI/CD "Cloud Build API". I pushed the images to Artifact Registry successfully.
My cloudbuild.yaml file looks like below:
steps:
- name: 'gcr.io/cloud-builder/docker'
args:
[
'build',
'-t',
'europe-west1-docker.pkg.dev/driven-atrium-414021/reservations/production',
'-f',
'apps/reservations/Dockerfile',
'.',
]
- name: 'gcr.io/cloud-builder/docker'
args:
[
'push',
'europe-west1-docker.pkg.dev/driven-atrium-414021/reservations/production',
]
- name: 'gcr.io/cloud-builder/docker'
args:
[
'build',
'-t',
'europe-west1-docker.pkg.dev/driven-atrium-414021/auth/production',
'-f',
'apps/auth/Dockerfile',
'.',
]
- name: 'gcr.io/cloud-builder/docker'
args:
[
'push',
'europe-west1-docker.pkg.dev/driven-atrium-414021/auth/production',
]
- name: 'gcr.io/cloud-builder/docker'
args:
[
'build',
'-t',
'europe-west1-docker.pkg.dev/driven-atrium-414021/notifications/production',
'-f',
'apps/notifications/Dockerfile',
'.',
]
- name: 'gcr.io/cloud-builder/docker'
args:
[
'push',
'europe-west1-docker.pkg.dev/driven-atrium-414021/notifications/production',
]
- name: 'gcr.io/cloud-builder/docker'
args:
[
'build',
'-t',
'europe-west1-docker.pkg.dev/driven-atrium-414021/payments/production',
'-f',
'apps/payments/Dockerfile',
'.',
]
- name: 'gcr.io/cloud-builder/docker'
args:
[
'push',
'europe-west1-docker.pkg.dev/driven-atrium-414021/payments/production',
]
I tried running $gcloud auth configure-docker gcr.io according to this source and I tried to play with permissions per other suggestions (new to GCP here) with no luck.
I got Caller does not have permission or the resource may not exist even though my user has the admin/owner role, I checked the repositories exists in the Artifact Repository. Here is a screenshot of my error from cloud build:
Any help on how to solve this problem?
2
Answers
It turns out, as @Marra commented, that the problem was mistyping the name of the cloud-builder/docker while it should be cloud-builders/docker (I missed the "s")
I find it strange that GCP error message didn't differentiate between a missing resource and an inaccessible existing one!
In your cloudbuild.yaml, change the names from
gcr.io/cloud-builder/docker
togcr.io/cloud-builders/docker
as stated in the documentation.