Last active
November 13, 2018 15:52
-
-
Save manekinekko/70d5cd20a87cd0b618c21e6f74e3c95d to your computer and use it in GitHub Desktop.
Google Cloud Build config file for xlayers.app (CI + CD)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
steps: | |
- name: 'gcr.io/cloud-builders/npm' | |
id: 'Install dependencies' | |
args: ['install'] | |
- name: 'gcr.io/cloud-builders/npm' | |
id: 'Lint' | |
args: ['run', 'lint'] | |
- name: 'gcr.io/cloud-builders/npm' | |
id: 'Test' | |
args: ['run', 'test:ci'] | |
- name: 'gcr.io/cloud-builders/npm' | |
id: 'Build' | |
args: ['run', 'build', '--', '--output-path', 'dist/html'] | |
env: | |
- 'BUILD_ID=$BUILD_ID' | |
# Build snapshot images and push them to Cloud Registry | |
- name: 'gcr.io/cloud-builders/docker' | |
id: 'Build deployable image (commit tag)' | |
args: ['build', '-t', 'gcr.io/$PROJECT_ID/xlayers:$SHORT_SHA', '.'] | |
- name: 'gcr.io/cloud-builders/docker' | |
id: 'Push deployable image (commit tag)' | |
args: ['push', 'gcr.io/$PROJECT_ID/xlayers:$SHORT_SHA'] | |
- name: 'gcr.io/cloud-builders/docker' | |
id: 'Build deployable image (latest tag)' | |
args: ['build', '-t', 'gcr.io/$PROJECT_ID/xlayers:latest', '.'] | |
- name: 'gcr.io/cloud-builders/docker' | |
id: 'Push deployable image (latest tag)' | |
args: ['push', 'gcr.io/$PROJECT_ID/xlayers:latest'] | |
# Patch a new Ingress ressource for the build $SHORT_SHA | |
- name: 'google/cloud-sdk:slim' | |
id: 'Generate a new Ingress Ressource, Service and Deployment' | |
entrypoint: 'sh' | |
args: | |
- '-c' | |
- | | |
perl -pe "s/_SHORT_SHA_/$SHORT_SHA/g" scripts/cloudbuild/xlayers.template.yaml > xlayers.$SHORT_SHA.yaml | |
# Apply a new Ingress ressource for the build $SHORT_SHA | |
- name: 'gcr.io/cloud-builders/kubectl' | |
id: 'Apply Kubectl configuration' | |
args: | |
- 'apply' | |
- '-f' | |
- 'xlayers.$SHORT_SHA.yaml' | |
env: | |
- 'CLOUDSDK_COMPUTE_ZONE=us-central1-a' | |
- 'CLOUDSDK_CONTAINER_CLUSTER=cluster-small' | |
images: | |
- 'gcr.io/$PROJECT_ID/xlayers:$SHORT_SHA' | |
- 'gcr.io/$PROJECT_ID/xlayers:latest' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment