Skip to content

Instantly share code, notes, and snippets.

@dictav
Last active August 3, 2020 05:52
Show Gist options
  • Save dictav/6d359b7b5b0a97e4ef8739dbf0e5082c to your computer and use it in GitHub Desktop.
Save dictav/6d359b7b5b0a97e4ef8739dbf0e5082c to your computer and use it in GitHub Desktop.
CloudRun+Git
steps:
- name: gcr.io/cloud-builders/docker
args:
- build
- '--no-cache'
- '-t'
- '$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA'
- grpc/hello
- '-f'
- grpc/hello/Dockerfile
id: Build
- name: gcr.io/cloud-builders/docker
args:
- push
- '$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA'
id: Push
- name: gcr.io/google.com/cloudsdktool/cloud-sdk
args:
- run
- deploy
- $_SERVICE_NAME
- '--platform=managed'
- '--image=$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA'
- >-
--labels=managed-by=gcp-cloud-build-deploy-cloud-run,commit-sha=$COMMIT_SHA,gcb-build-id=$BUILD_ID,gcb-trigger-id=$_TRIGGER_ID,$_LABELS
- '--region=$_DEPLOY_REGION'
- '--quiet'
id: Deploy
entrypoint: gcloud
images:
- '$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA'
options:
substitutionOption: ALLOW_LOOSE
substitutions:
_PLATFORM: managed
_LABELS: gcb-trigger-id=2a974e37-c19d-4459-81da-0410e3b80459
_TRIGGER_ID: 2a974e37-c19d-4459-81da-0410e3b80459
_SERVICE_NAME: grpc-hello
_DEPLOY_REGION: us-central1
_GCR_HOSTNAME: us.gcr.io
tags:
- gcp-cloud-build-deploy-cloud-run
- gcp-cloud-build-deploy-cloud-run-managed
- grpc-hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment