Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save giuliohome/b37507f79ff63610277f9a38c30d6f91 to your computer and use it in GitHub Desktop.
Save giuliohome/b37507f79ff63610277f9a38c30d6f91 to your computer and use it in GitHub Desktop.
Google Cloud Run - build trigger - inline yaml
steps:
- name: gcr.io/cloud-builders/docker
args:
- build
- '--no-cache'
- '-t'
- '$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA'
- .
- '-f'
- Dockerfile
id: Build
- name: gcr.io/cloud-builders/docker
args:
- push
- '$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA'
id: Push
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk:slim'
args:
- run
- services
- update
- $_SERVICE_NAME
- '--platform=managed'
- '--image=$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME/$_SERVICE_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/$_SERVICE_NAME:$COMMIT_SHA'
options:
substitutionOption: ALLOW_LOOSE
substitutions:
_TRIGGER_ID: 7966ed4a-97ff-4476-b117-bb3660f423eb
_DEPLOY_REGION: us-central1
_SERVICE_NAME: flask-sqlserver-googlekubernetesengine
_GCR_HOSTNAME: us.gcr.io
_PLATFORM: managed
_LABELS: gcb-trigger-id=7966ed4a-97ff-4476-b117-bb3660f423eb
tags:
- gcp-cloud-build-deploy-cloud-run
- gcp-cloud-build-deploy-cloud-run-managed
- flask-sqlserver-googlekubernetesengine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment