I have a strange problem. I setup continous delivery for cloud run when I commit to a specific dev branch of my github code.
When I commit, I see it notices the change and builds the code but it does not automatically deploy it to the cloud run instance.
I have to manually select edit and deploy new revision then select the image that was created.
What can I do to automatically deploy?
I figured it out. Documentation here
I think the problem was that cloud build continuous deployment setup automates the building when a change is detected in my github repo but it didn't actually deploy the image it built.
I had to create a file called cloudbuild.yaml and save this file(updated for my cloud run instance)
steps:
# Build the container image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/SERVICE-NAME:$COMMIT_SHA', '.']
# Push the container image to Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/SERVICE-NAME:$COMMIT_SHA']
# Deploy container image to Cloud Run
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args:
- 'run'
- 'deploy'
- 'SERVICE-NAME'
- '--image'
- 'gcr.io/$PROJECT_ID/SERVICE-NAME:$COMMIT_SHA'
- '--region'
- 'REGION'
images:
- 'gcr.io/$PROJECT_ID/SERVICE-NAME:$COMMIT_SHA'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With