| # These are the testing and deploy steps for the performance dashboard |
| # services. We re-use the docker-compose files in the dev_dockerfiles directory |
| # to ensure we're runing the same test and deploy cycle everytime. |
| timeout: 1800s # Wait for 30 minutes for the whole process to finish. |
| options: |
| diskSizeGb: 100 |
| machineType: 'N1_HIGHCPU_8' |
| steps: |
| - name: 'gcr.io/cloud-builders/docker' |
| entrypoint: 'bash' |
| args: |
| - '-c' |
| - | |
| docker pull gcr.io/$PROJECT_ID/dashboard-base:latest || exit 0 |
| - name: 'gcr.io/cloud-builders/docker' |
| dir: 'dashboard/dev_dockerfiles' |
| args: [ |
| 'build', |
| '-t', 'dashboard-base:latest', |
| '-t', 'gcr.io/$PROJECT_ID/dashboard-base:latest', |
| '--cache-from', 'gcr.io/$PROJECT_ID/dashboard-base:latest', |
| '.' |
| ] |
| - name: 'gcr.io/$PROJECT_ID/docker-compose' |
| dir: 'dashboard/dev_dockerfiles' |
| args: [ |
| 'run', 'python-unittest-dashboard' |
| ] |
| # We need to provide the auth token that the service account is using to the |
| # container from which we're going to deploy the Dashboard services. |
| - name: 'gcr.io/$PROJECT_ID/docker-compose' |
| dir: 'dashboard/dev_dockerfiles' |
| args: [ |
| 'run', 'cloudbuild-prepare-deployment' |
| ] |
| - name: 'gcr.io/cloud-builders/gcloud' |
| dir: 'deploy-dashboard' |
| args: [ |
| app, deploy, '--no-promote', '--version', 'cloud-build-${SHORT_SHA}', |
| # We enumerate the files we need to deploy just for the dashboard. |
| # TODO(dberris): Figure out how we can include cron.yaml and dispatch.yaml |
| # from this automation. This fails in production with the service account |
| # used by cloud-build, so we've left it out for now. |
| api.yaml, |
| app.yaml, |
| upload-processing.yaml, |
| upload.yaml, |
| pinpoint.yaml, |
| ] |
| - name: 'gcr.io/cloud-builders/gcloud' |
| dir: 'deploy-dashboard' |
| args: [ |
| 'app', 'deploy', 'queue.yaml', |
| ] |
| # We check in the target versions to avoid unintended traffic changes. |
| - name: 'gcr.io/cloud-builders/gcloud' |
| id: 'Set traffic for default service' |
| dir: 'deploy-dashboard' |
| args: [ |
| 'app', 'services', 'set-traffic', 'default', |
| '--splits=cloud-build-568df55=1' |
| ] |
| - name: 'gcr.io/cloud-builders/gcloud' |
| id: 'Set traffic for api service' |
| dir: 'deploy-dashboard' |
| args: [ |
| 'app', 'services', 'set-traffic', 'api', |
| '--splits=cloud-build-7b96e7a=1' |
| ] |
| - name: 'gcr.io/cloud-builders/gcloud' |
| id: 'Set traffic for upload service' |
| dir: 'deploy-dashboard' |
| args: [ |
| 'app', 'services', 'set-traffic', 'upload', |
| '--splits=cloud-build-7b96e7a=1' |
| ] |
| - name: 'gcr.io/cloud-builders/gcloud' |
| id: 'Set traffic for upload-processing service' |
| dir: 'deploy-dashboard' |
| args: [ |
| 'app', 'services', 'set-traffic', 'upload-processing', |
| '--splits=cloud-build-efe5fd8=1', |
| ] |
| - name: 'gcr.io/cloud-builders/gcloud' |
| id: 'Set traffic for pinpoint service' |
| dir: 'deploy-dashboard' |
| args: [ |
| 'app', 'services', 'set-traffic', 'pinpoint', |
| '--splits=cloud-build-3cdf63a=1' |
| ] |
| - name: 'gcr.io/cloud-builders/gcloud' |
| entrypoint: '/bin/bash' |
| args: [ |
| '-x', '-e', 'dashboard/dev_dockerfiles/cleanup_versions.sh', |
| 'api', 'default', 'pinpoint', 'upload-processing', 'upload' |
| ] |
| images: ['gcr.io/$PROJECT_ID/dashboard-base:latest'] |