Reputation: 22284
Execute gcloud builds submit
from the local directory in my PC where the cloudbuild.yaml is located.
cloudbuild.yaml
steps:
# Docker Build
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- 'us-central1-docker.pkg.dev/$PROJECT_ID/diabetes-prediction/diabetes-prediction-api:$SHORT_SHA'
- '-f'
- 'src/serving/Dockerfile'
- '.'
The build fails because SHORT_SHA
is empty causing invalid tag name ending with diabetes-prediction-api:
.
Starting Step #0
Step #0: Already have image (with digest): gcr.io/cloud-builders/docker
Step #0: invalid argument "us-central1-docker.pkg.dev/default-338305/diabetes-prediction/diabetes-prediction-api:" for "-t, --tag" flag: invalid reference format
Please advise what is wrong.
Upvotes: 0
Views: 1432
Reputation: 40231
You need to invoke the build as a trigger (from a repo) for the repo-specific values to be set.
See Using default substitutions
Upvotes: 2