Skip to content

Instantly share code, notes, and snippets.

@seahrh
Created April 6, 2020 04:14
Show Gist options
  • Save seahrh/23ffc35d20e4c2973e64fe07df68f582 to your computer and use it in GitHub Desktop.
Save seahrh/23ffc35d20e4c2973e64fe07df68f582 to your computer and use it in GitHub Desktop.
cloudbuild cicd single pipeline: test, build, deploy
steps:
- id: 'tests'
name: 'python:3.7-slim-buster'
args: ['bash', './scripts/tests.sh']
- id: 'build'
name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', '${_IMAGE_NAME}:${BRANCH_NAME}', '.']
- id: 'push'
name: 'gcr.io/cloud-builders/docker'
args: ['push', '${_IMAGE_NAME}:${BRANCH_NAME}']
- id: 'deploy'
name: 'asia.gcr.io/my_gcp_project/helm:2.10.0'
entrypoint: 'sh'
args: ['./scripts/install.sh']
env:
- 'ENVIRONMENT=${_ENVIRONMENT}'
- 'IMAGE_NAME=${_IMAGE_NAME}'
- 'IMAGE_TAG=${BRANCH_NAME}'
- 'NAMESPACE=${_NAMESPACE}'
- 'OWNER=${_OWNER}'
- 'REPO_NAME=${REPO_NAME}'
images: ['${_IMAGE_NAME}:${BRANCH_NAME}']
substitutions:
_ENVIRONMENT: ''
_IMAGE_NAME: 'asia.gcr.io/my_gcp_project/my_app'
_NAMESPACE: 'my_namespace'
_OWNER: 'my_email'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment