-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcloudbuild.yaml
71 lines (59 loc) · 2.63 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
steps:
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args:
- '-c'
- |
docker pull gcr.io/trainsplorer/tspl-builder:latest || exit 0
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args:
- '-c'
- |
pkgs=("tspl-builder" "tspl-compiled" "tspl-base" "tspl-fahrplan" "tspl-zugfuhrer" "tspl-nrod" "tspl-fahrplan-updater" "tspl-verknupfen" "tspl-nennen" "tspl-web"); for thing in ${pkgs[@]}; do docker build -f "docker/$thing" -t "$thing" --cache-from gcr.io/trainsplorer/tspl-builder:latest .; done
timeout: 4000s
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args:
- '-c'
- |
pkgs=("tspl-builder" "tspl-fahrplan" "tspl-zugfuhrer" "tspl-nrod" "tspl-fahrplan-updater" "tspl-verknupfen" "tspl-nennen" "tspl-web"); for thing in ${pkgs[@]}; do docker tag "$thing" "gcr.io/trainsplorer/$thing:latest"; docker tag "$thing" "gcr.io/trainsplorer/$thing:$COMMIT_SHA"; docker push "gcr.io/trainsplorer/$thing"; done
- name: 'gcr.io/cloud-builders/gcloud'
args: ['container', 'clusters', 'get-credentials', 'tspl-cluster-ii']
env:
- 'CLOUDSDK_COMPUTE_ZONE=europe-west1-d'
- 'CLOUDSDK_CONTAINER_CLUSTER=tspl-cluster-ii'
- name: 'gcr.io/cloud-builders/kubectl'
entrypoint: 'bash'
args:
- '-c'
- |
[[ "$BRANCH_NAME" == "master" ]] && pkgs=("tspl-zugfuhrer"); for thing in ${pkgs[@]}; do kubectl -n tspl set image statefulset "$thing" "$thing=gcr.io/trainsplorer/$thing:$COMMIT_SHA"; done
- name: 'gcr.io/cloud-builders/kubectl'
entrypoint: 'bash'
args:
- '-c'
- |
[[ "$BRANCH_NAME" == "master" ]] && pkgs=("tspl-nrod" "tspl-fahrplan" "tspl-verknupfen" "tspl-web"); for thing in ${pkgs[@]}; do kubectl -n tspl set image deployment "$thing" "$thing=gcr.io/trainsplorer/$thing:$COMMIT_SHA"; done
- name: 'gcr.io/cloud-builders/kubectl'
entrypoint: 'bash'
args:
- '-c'
- |
[[ "$BRANCH_NAME" == "master" ]] && kubectl -n tspl set image deployment "tspl-darwin" "tspl-nrod=gcr.io/trainsplorer/tspl-nrod:$COMMIT_SHA"
- name: 'gcr.io/cloud-builders/kubectl'
entrypoint: 'bash'
args:
- '-c'
- |
[[ "$BRANCH_NAME" == "master" ]] && kubectl -n tspl set image cronjob "tspl-fahrplan-updater" "tspl-fahrplan-updater=gcr.io/trainsplorer/tspl-fahrplan-updater:$COMMIT_SHA"
images:
- 'gcr.io/trainsplorer/tspl-builder:latest'
- 'gcr.io/trainsplorer/tspl-fahrplan:$COMMIT_SHA'
- 'gcr.io/trainsplorer/tspl-zugfuhrer:$COMMIT_SHA'
- 'gcr.io/trainsplorer/tspl-nrod:$COMMIT_SHA'
- 'gcr.io/trainsplorer/tspl-fahrplan-updater:$COMMIT_SHA'
- 'gcr.io/trainsplorer/tspl-verknupfen:$COMMIT_SHA'
- 'gcr.io/trainsplorer/tspl-nennen:$COMMIT_SHA'
- 'gcr.io/trainsplorer/tspl-web:$COMMIT_SHA'
timeout: 5000s