Skip to content

Instantly share code, notes, and snippets.

@fawix
Last active January 11, 2022 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fawix/9d409ebb22d280dda4eb81ce29c065bb to your computer and use it in GitHub Desktop.
Save fawix/9d409ebb22d280dda4eb81ce29c065bb to your computer and use it in GitHub Desktop.
translate/cloudbuild.yaml
# Licensing CC BY-SA 4.0
Steps:
# CI Pipeline: static tests
- id: 'app-hana-be: static tests'
name: 'gcr.io/$PROJECTID/be-build-env'
waitFor: ['-']
dir: translate
args:
- -c
- >
echo "running: go vet -v" &&
go vet -v
# CI Pipeline: unit + functional tests
- id: 'app-hana-be: unit tests'
name: 'gcr.io/$PROJECTID/be-build-env'
waitFor: ['app-hana-be: static tests']
dir: translate
args:
- -c
- >
echo "running go test -v" &&
go test -v
# CI Pipeline: static tests
- id: 'app-hana-be: build container'
name: 'gcr.io/cloud-builders/docker'
waitFor:
- 'app-hana-be: static tests'
- 'app-hana-be: unit tests'
dir: translate
args: ['build', '-t', 'gcr.io/$PROJECTID/app-hana-be-cicd', '.']
# CD Pipeline: push container to GCR
- id: 'app-hana-be: push container'
name: 'gcr.io/cloud-builders/docker'
waitFor:
- 'app-hana-be: build container'
dir: translate
args: ['push', 'gcr.io/$PROJECTID/app-hana-be']
# CD Pipeline: deploy to Cloud Run
- id: 'app-hana-be: deploy container'
name: 'gcr.io/cloud-builders/gcloud'
waitFor:
- 'app-hana-be: push container'
dir: translate
args:
- 'run'
- 'deploy'
- 'app-hana-be-cicd'
- '--image'
- 'gcr.io/$PROJECTID/app-hana-be'
- '--region'
- 'us-central1'
- '--platform'
- 'managed'
- '--allow-unauthenticated'
# CI Pipeline: integration tests would go here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment