-
Notifications
You must be signed in to change notification settings - Fork 6
/
cloudbuild.yaml
149 lines (134 loc) · 4.92 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# NOTE: The stats-pipeline queries always read from the measurement-lab project.
# This deployment is currently disabled in staging to prevent processing production data multiple times per day.
steps:
- name: "gcr.io/cloud-builders/docker"
id: "Build the docker container"
args: ["build", "-t", "gcr.io/$PROJECT_ID/stats-pipeline:$_DOCKER_TAG", "."]
- name: "gcr.io/cloud-builders/docker"
id: "Push the docker container to gcr.io"
args: ["push", "gcr.io/$PROJECT_ID/stats-pipeline:$_DOCKER_TAG"]
- name: "gcr.io/cloud-builders/kubectl"
id: "Create configmap manifest"
entrypoint: /bin/bash
args:
- -c
- |
kubectl create configmap stats-pipeline-config \
--from-file=k8s/$_CLUSTER_NAME/config -o yaml --dry-run > \
configmap-manifest.json
- name: "gcr.io/cloud-builders/kubectl"
id: "Apply configmap"
args:
- apply
- -f
- configmap-manifest.json
env:
- CLOUDSDK_COMPUTE_REGION=$_COMPUTE_REGION
- CLOUDSDK_CONTAINER_CLUSTER=$_CLUSTER_NAME
- name: "gcr.io/cloud-builders/gcloud"
id: "Generate manifest for stats-pipeline deployment"
entrypoint: /bin/sh
args:
- -c
- |
sed 's/{{GCLOUD_PROJECT}}/${PROJECT_ID}/g' \
k8s/$_CLUSTER_NAME/deployments/stats-pipeline.yaml.template > \
manifest.yaml
- name: "gcr.io/cloud-builders/gke-deploy"
id: "Create stats-pipeline deployment"
args:
- run
- --filename=manifest.yaml
- --image=gcr.io/$PROJECT_ID/stats-pipeline:$_DOCKER_TAG
- --location=$_COMPUTE_REGION
- --cluster=$_CLUSTER_NAME
# gke-deploy will fail if the output folder is non-empty, thus we use
# different folders for the two executions of this tool.
- --output=pipeline/
- name: "gcr.io/cloud-builders/kubectl"
id: "Create stats-pipeline service"
args:
- apply
- -f
- k8s/$_CLUSTER_NAME/services/stats-pipeline.yaml
env:
- CLOUDSDK_COMPUTE_REGION=$_COMPUTE_REGION
- CLOUDSDK_CONTAINER_CLUSTER=$_CLUSTER_NAME
- name: "gcr.io/cloud-builders/gcloud"
id: "Generate manifest for hopannotation1-export deployment"
entrypoint: /bin/sh
args:
- -c
- |
sed 's/{{GCLOUD_PROJECT}}/${PROJECT_ID}/g' \
k8s/$_CLUSTER_NAME/deployments/hopannotation1-export-template.yaml > \
hopannotation1-export-manifest.yaml
# hopannotation1 export deployment and service.
- name: "gcr.io/cloud-builders/gke-deploy"
id: "Create hopannotation1-export deployment"
args:
- run
- --filename=hopannotation1-export-manifest.yaml
- --image=gcr.io/$PROJECT_ID/stats-pipeline:$_DOCKER_TAG
- --location=$_COMPUTE_REGION
- --cluster=$_CLUSTER_NAME
# gke-deploy will fail if the output folder is non-empty, thus we use
# different folders for the two executions of this tool.
- --output=hopannotation1-export/
- name: "gcr.io/cloud-builders/kubectl"
id: "Create hopannotation1-export service"
args:
- apply
- -f
- k8s/$_CLUSTER_NAME/services/hopannotation1-export.yaml
env:
- CLOUDSDK_COMPUTE_REGION=$_COMPUTE_REGION
- CLOUDSDK_CONTAINER_CLUSTER=$_CLUSTER_NAME
- name: "gcr.io/cloud-builders/docker"
id: "Build the stats-pipeline-runner docker container"
args: ["build", "-t", "gcr.io/$PROJECT_ID/stats-pipeline-runner:$_DOCKER_TAG", "maptiles/"]
- name: "gcr.io/cloud-builders/docker"
id: "Push the stats-pipeline-runner docker container to gcr.io"
args: ["push", "gcr.io/$PROJECT_ID/stats-pipeline-runner:$_DOCKER_TAG"]
- name: "gcr.io/cloud-builders/gcloud"
id: "Generate manifest for the stats-pipeline-cronjob"
entrypoint: /bin/sh
args:
- -c
- |
sed -e 's/{{GCLOUD_PROJECT}}/${PROJECT_ID}/g' \
-e "s/{{PIPELINE_CRON_SCHEDULE}}/${_PIPELINE_CRON_SCHEDULE}/g" \
k8s/$_CLUSTER_NAME/jobs/stats-pipeline-cronjob.yaml.template > \
stats-pipeline-cronjob.yaml
- name: "gcr.io/cloud-builders/gcloud"
id: "Generate manifest for the hopannotation1-export-cronjob"
entrypoint: /bin/sh
args:
- -c
- |
sed -e 's/{{GCLOUD_PROJECT}}/${PROJECT_ID}/g' \
-e "s/{{ANNOTATION_EXPORT_CRON_SCHEDULE}}/${_ANNOTATION_EXPORT_CRON_SCHEDULE}/g" \
k8s/$_CLUSTER_NAME/jobs/hopannotation1-export-cronjob.template > \
hopannotation1-export-cronjob.yaml
- name: "gcr.io/cloud-builders/gke-deploy"
id: "Create stats-pipeline CronJob"
args:
- run
- --filename=stats-pipeline-cronjob.yaml
- --image=gcr.io/$PROJECT_ID/stats-pipeline-runner:$_DOCKER_TAG
- --location=$_COMPUTE_REGION
- --cluster=$_CLUSTER_NAME
# gke-deploy will fail if the output folder is non-empty, thus we use
# different folders for the two executions of this tool.
- --output=stats-pipeline-runner/
- name: "gcr.io/cloud-builders/gke-deploy"
id: "Create hopannotation1-export CronJob"
args:
- run
- --filename=hopannotation1-export-cronjob.yaml
- --image=gcr.io/$PROJECT_ID/stats-pipeline-runner:$_DOCKER_TAG
- --location=$_COMPUTE_REGION
- --cluster=$_CLUSTER_NAME
# gke-deploy will fail if the output folder is non-empty, thus we use
# different folders for the two executions of this tool.
- --output=hopannotation1-export-runner/