-
Notifications
You must be signed in to change notification settings - Fork 114
/
cloudbuild.yaml
31 lines (30 loc) · 1.29 KB
/
cloudbuild.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Overview: build and create a release via Google Cloud Deploy for GKE
# NOTE: currently requires SCM triggering due to dependency on the COMMIT_SHA variable
steps:
# Build and tag using commit sha
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '.', '-t', 'us-central1-docker.pkg.dev/$PROJECT_ID/pop-stats/pop-stats:${COMMIT_SHA}', '-f', 'Dockerfile']
dir: 'app'
# Run api tests
- name: 'us-central1-docker.pkg.dev/$PROJECT_ID/pop-stats/pop-stats:${COMMIT_SHA}'
entrypoint: python
args: ["api_tests.py"]
dir: 'app'
# Push the container image to Artifact Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'us-central1-docker.pkg.dev/$PROJECT_ID/pop-stats/pop-stats:${COMMIT_SHA}']
# Create release in Google Cloud Deploy
- name: gcr.io/google.com/cloudsdktool/cloud-sdk
entrypoint: gcloud
args:
[
"deploy", "releases", "create", "rel-${SHORT_SHA}",
"--delivery-pipeline", "pop-stats-pipeline",
"--region", "us-central1",
"--annotations", "commitId=${REVISION_ID}",
"--images", "pop-stats=us-central1-docker.pkg.dev/$PROJECT_ID/pop-stats/pop-stats:${COMMIT_SHA}"
]
images:
- us-central1-docker.pkg.dev/$PROJECT_ID/pop-stats/pop-stats:${COMMIT_SHA}
options:
requestedVerifyOption: VERIFIED