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
45 lines (42 loc) · 1.12 KB
/
cloudbuild.yaml
File metadata and controls
45 lines (42 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
steps:
- name: 'gcr.io/track-compliance/ci'
id: test-https
dir: services/scanners/https
entrypoint: /bin/sh
args: ["-c", "pip3 install -r requirements.txt && python3 -m pytest"]
- name: 'gcr.io/cloud-builders/docker'
id: generate-image-name
entrypoint: 'bash'
dir: services/scanners/https
args:
- '-c'
- |
echo "gcr.io/$PROJECT_ID/services/scanners/https:$BRANCH_NAME-$SHORT_SHA-$(date +%s)" > /workspace/imagename
- name: 'gcr.io/cloud-builders/docker'
id: build-https-if-master
entrypoint: 'bash'
dir: services/scanners/https
args:
- '-c'
- |
if [[ "$BRANCH_NAME" == "master" ]]
then
image=$(cat /workspace/imagename)
docker build -t $image .
else
exit 0
fi
- name: 'gcr.io/cloud-builders/docker'
id: push-https-if-master
entrypoint: 'bash'
dir: services/scanners/https
args:
- '-c'
- |
if [[ "$BRANCH_NAME" == "master" ]]
then
image=$(cat /workspace/imagename)
docker push $image
else
exit 0
fi