Hi Team,
cloud build doesn't recognize build directory for docker images to the artifact registry, whily triggering job its throwing error as
tep #2: Successfully built 42d23e382d82 Step #2: Successfully tagged asia-south1-docker.pkg.dev/gcp/csd-icp-product:e442b278-a43d-4eb3-b3e8-5550d45691f8 Finished Step #2 Starting Step #3 Step #3: Already have image (with digest): gcr.io/cloud-builders/docker Step #3: The push refers to repository [asia-south1-docker.pkg.dev/gcpnagement/csd-icp-product/663638a1-fa3a-41ed-b51e-80eb88ffb6f6] Step #3: An image does not exist locally with the tag: asia-south1-docker.pkg.dev/gcpfleetmanagement/csd-icp-product/663638a1-fa3a-41ed-b51e-80eb88ffb6f6 Finished Step #3 ERROR ERROR: build step 3 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1
any idea what is causing this isssue, here's full script cloudbuild.yaml
Hello avinashsr,
Welcome to Google Cloud Community!
The error message indicates that Cloud Build is unable to find the built image locally before attempting to push it to the Artifact Registry. This mismatch is causing the push to fail. Here's a breakdown of the issue and potential solutions based on your cloudbuild.yaml script:
Problem: Cloud Build builds the image but cannot find it with the specific tag you're trying to push in step 3.
Possible Reasons:
Solutions:
YAML:
- name: 'gcr.io/cloud-builders/docker'
dir: '/workspace/cicd-icp/csd-icp-product-main/icp-api-server-develop/icp-api-server-develop'
args: ['build', '-t', 'asia-south1-docker.pkg.dev/$PROJECT_ID/csd-icp-product:$BUILD_ID', '-f', 'Dockerfile', '.']
Additional Tips:
I hope the above information is helpful.