How to kick off a deployment after a cloud build is complete?

Objective:

1. build source code (docker image)

2. upload to artifact registry

3. deploy to cloud run

I was trying to do it like this in a cloud.yaml file:

 
steps:
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '--network=cloudbuild', '-t', ...]
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: 'bash'
args: [./scripts/deploy-cloud-run.sh] # this is a custom script I have that needs to be executed to deploy to cloud run
images:
- 'us.gcr.io/project/repo/image'
 
What this is doing is:
 
1. build source code (docker image)
3. deploy to cloud run
2. upload docker image to artifact registry
 
How can I tell it to do 1 -> 2 ->3 in my original objective?
1 2 124
2 REPLIES 2

Looking at your logic, it seems that currently you are executing Cloud Build that builds a docker image and stores the result.  You are then running a shell script which we don't know what it does.  Based on this, should we assume that the script tried to deploy the image to Cloud Run?  If not, what does the script do?

You can consider using Cloud Deploy to perform the deployment. A deployment (rollout) is based on a release. The release, the rollout, and the logs associated with the deployment are available after a deployment. You can also perform canary deployments with Cloud Deploy. You can find a quickstart, here.