I have two GitHub repos (let's call them Repo1 and Repo2) in two Cloud Build triggers. Both have the same Service Account, GitHub account, GCP project, and both repos exist in Artifact Registry.
Repo1's Docker image is pushed to the Artifact Registry but the problem is Repo2's image does not appear in the Artifact Registry.
No error appears in Repo2's Build log. But the Repo2's Build logs stop at the tag phase:
Step #0: Successfully built 4c46XXXX
Step #0: Successfully tagged us-docker.pkg.dev/my-project/repo2/main:latest
Finished Step #0
As comparison, Repo1's Build log indicates the Docker image is created AND pushed to Artifact Registry:
Successfully built XXXXX
Successfully tagged us-docker.pkg.dev/my-project/repo1/repo1:latest
PUSH
Pushing us-docker.pkg.dev/my-project/repo1/repo1
The push refers to repository [us-docker.pkg.dev/my-project/repo1/main]
...
XXX: Layer already exists
XXX: Pushed
latest: digest: sha256:XXXXXX
DONE
cloudbuild.yaml for Repo1:
steps:
- name: gcr.io/cloud-builders/docker
args: [build, -t, $_GCR/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME, "."]
images: [$_GCR/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME]
options:
logging: CLOUD_LOGGING_ONLY
substitutions:
_GCR: us-docker.pkg.dev
NOTE: $REPONAME is "repo1".
Repo1 has the Artifact Registry path at us-docker.pkg.dev/my-project/repo1
and I can verify the output as successful.
cloudbuild.yaml for Repo2:
steps:
- name: gcr.io/cloud-builders/docker
args:
[
build,
-t,
us-docker.pkg.dev/$PROJECT_ID/$_SERVICE_NAME/$BRANCH_NAME,
-f,
Dockerfile,
".",
]
id: Build service
- name: gcr.io/cloud-builders/docker
entrypoint: docker
args:
[
run,
SERVICE_NAME=$_SERVICE_NAME,
$_VM_CLEANUP_IMAGE,
]
id: Deleting oldest VM for service
tags: [$COMMIT_SHA, $TRIGGER_NAME]
images: [us-docker.pkg.dev/$PROJECT_ID/$_SERVICE_NAME/$BRANCH_NAME]
options:
logging: CLOUD_LOGGING_ONLY
substitutions:
_SERVICE_NAME: "repo2"
Repo2 has the Artifact Registry path at us-docker.pkg.dev/my-project/repo2
which is empty.
I've tried:
- Checked for permissions but the two build triggers use the same Service Account and no error messages nor indication of permission issues
- https://cloud.google.com/build/docs/troubleshooting
- https://cloud.google.com/build/docs/deploying-builds/deploy-cloud-run
- Why Can't I Pull Google Artifact Registry Docker Images Build with Google Cloud Build?
- Docker fails to push images to Google Cloud Registry