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
executable file
·54 lines (49 loc) · 1.37 KB
/
cloudbuild.yaml
File metadata and controls
executable file
·54 lines (49 loc) · 1.37 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
50
51
52
53
54
steps:
- name: 'gcr.io/cloud-builders/docker'
id: start_testdb
entrypoint: /bin/sh
args: ["-c", "docker run --net cloudbuild --name testdb -e ARANGO_NO_AUTH=1 -d -p 127.0.0.1:8529:8529 arangodb"]
- name: mikewilliamson/wait-for
id: wait_testdb
args: ['testdb:8529']
- name: 'gcr.io/track-compliance/ci'
id: test-results
dir: services/results
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/results
args:
- '-c'
- |
echo "gcr.io/$PROJECT_ID/services/results:$BRANCH_NAME-$SHORT_SHA-$(date +%s)" > /workspace/imagename
- name: 'gcr.io/cloud-builders/docker'
id: build-results-if-master
entrypoint: 'bash'
dir: services/results
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-results-if-master
entrypoint: 'bash'
dir: services/results
args:
- '-c'
- |
if [[ "$BRANCH_NAME" == "master" ]]
then
image=$(cat /workspace/imagename)
docker push $image
else
exit 0
fi