Skip to content

Instantly share code, notes, and snippets.

@learngcpwithmahesh
Last active November 2, 2021 20:01
Show Gist options
  • Save learngcpwithmahesh/4021573c2d7a5be17e98f482d19bf145 to your computer and use it in GitHub Desktop.
Save learngcpwithmahesh/4021573c2d7a5be17e98f482d19bf145 to your computer and use it in GitHub Desktop.
steps:
#First Clone from Google Cloud Source Repository
- name: 'gcr.io/cloud-builders/git'
args: ['clone','https://source.developers.google.com/p/${_PROJECT}/r/${_REPO_NAME}']
#Build & Push the image
- name: 'gcr.io/cloud-builders/gcloud'
args: ['builds','submit','--tag','gcr.io/${_PROJECT}/${_CONTAINER_IMAGE_NAME}:$SHORT_SHA','.']
#Deploy Cloud Run
- name: 'gcr.io/cloud-builders/gcloud'
args:
- run
- deploy
- evonence-hello-world
- '--platform=managed'
- '--image=gcr.io/${_PROJECT}/${_CONTAINER_IMAGE_NAME}:$SHORT_SHA'
- '--region=${_REGION}'
- '--timeout=60'
- '--service-account=cloudrun-svc@${_PROJECT}.iam.gserviceaccount.com'
- '--allow-unauthenticated'
- '--project=${_PROJECT}'
substitutions:
#GCP Specific configuration. Please DON'T change anything
_PROJECT: YOUR-PROJECT-ID #Please replace this with your GCP Project ID
_REGION: us-central1
#Repository Specific configuration. DevOps can change this settings
_CONTAINER_IMAGE_NAME: cloudrun/dev/evonence-hello-world
_REPO_NAME: evonence-hello-world
options:
substitution_option: 'ALLOW_LOOSE'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment