forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
49 lines (44 loc) · 1.12 KB
/
cloudbuild.yaml
File metadata and controls
49 lines (44 loc) · 1.12 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
steps:
- name: node:alpine
id: install
dir: database-migration
entrypoint: npm
args: ['ci', '--no-optional']
- name: node:alpine
id: lint
dir: database-migration
entrypoint: npm
args: ['run', lint]
- name: 'gcr.io/cloud-builders/docker'
id: generate-image-name
entrypoint: 'bash'
dir: database-migration
args:
- '-c'
- |
echo "northamerica-northeast1-docker.pkg.dev/track-compliance/tracker/database-migration:$(echo $BRANCH_NAME | sed 's/[^a-zA-Z0-9]/-/g')-$SHORT_SHA-$(date +%s)" > /workspace/imagename
- name: 'gcr.io/cloud-builders/docker'
id: build
entrypoint: 'bash'
dir: database-migration
args:
- '-c'
- |
image=$(cat /workspace/imagename)
docker build -t $image .
- name: 'gcr.io/cloud-builders/docker'
id: push-if-master
entrypoint: 'bash'
args:
- '-c'
- |
if [[ "$BRANCH_NAME" == "master" ]]
then
image=$(cat /workspace/imagename)
docker push $image
else
exit 0
fi
timeout: 1200s
options:
machineType: 'E2_HIGHCPU_8'