This repository has been archived by the owner on Jun 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.sh
executable file
·320 lines (301 loc) · 9.79 KB
/
build.sh
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
#!/bin/bash
set -e
show_help() {
echo "Usage: $0 [option...]" >&2
echo
echo " -h, --help show this usage message"
echo " -r, --registry_version COmanage Registry version"
echo " --registry_base_image_version"
echo " --basic_auth_image_version"
echo " --shibboleth_sp_version"
echo " --shibboleth_sp_base_image_version"
echo " --shibboleth_sp_image_version"
echo " --mod_auth_openidc_image_version"
echo " --i2_base_image_version"
echo " --i2_image_version"
echo " --postgres_image_version"
echo " --slapd_base_image_version"
echo " --slapd_image_version"
echo " --slapd_proxy_image_version"
echo " -d, --docker_registry Docker registry to push into"
echo
}
# Default values.
COMANAGE_REGISTRY_VERSION="3.2.1"
COMANAGE_REGISTRY_BASE_IMAGE_VERSION="1"
COMANAGE_REGISTRY_BASIC_AUTH_IMAGE_VERSION="1"
COMANAGE_REGISTRY_SHIBBOLETH_SP_VERSION="3.0.4"
COMANAGE_REGISTRY_SHIBBOLETH_SP_BASE_IMAGE_VERSION="1"
COMANAGE_REGISTRY_SHIBBOLETH_SP_IMAGE_VERSION="1"
COMANAGE_REGISTRY_MOD_AUTH_OPENIDC_IMAGE_VERSION="1"
COMANAGE_REGISTRY_I2_BASE_IMAGE_VERSION="1"
COMANAGE_REGISTRY_I2_IMAGE_VERSION="1"
COMANAGE_REGISTRY_POSTGRES_IMAGE_VERSION="1"
COMANAGE_REGISTRY_SLAPD_BASE_IMAGE_VERSION="2"
COMANAGE_REGISTRY_SLAPD_IMAGE_VERSION="2"
COMANAGE_REGISTRY_SLAPD_PROXY_IMAGE_VERSION="2"
DOCKER_REGISTRY=
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
show_help
exit 0
;;
-r|--registry_version)
COMANAGE_REGISTRY_VERSION="$2"
shift # past argument
shift # past value
;;
--registry_base_image_version)
COMANAGE_REGISTRY_BASE_IMAGE_VERSION="$2"
shift # past argument
shift # past value
;;
--basic_auth_image_version)
COMANAGE_REGISTRY_BASIC_AUTH_IMAGE_VERSION="$2"
shift # past argument
shift # past value
;;
--shibboleth_sp_version)
COMANAGE_REGISTRY_SHIBBOLETH_SP_VERSION="$2"
shift # past argument
shift # past value
;;
--shibboleth_sp_base_image_version)
COMANAGE_REGISTRY_SHIBBOLETH_SP_BASE_IMAGE_VERSION="$2"
shift # past argument
shift # past value
;;
--shibboleth_sp_image_version)
COMANAGE_REGISTRY_SHIBBOLETH_SP_IMAGE_VERSION="$2"
shift # past argument
shift # past value
;;
--mod_auth_openidc_image_version)
COMANAGE_REGISTRY_MOD_AUTH_OPENIDC_IMAGE_VERSION="$2"
shift # past argument
shift # past value
;;
--i2_base_image_version)
COMANAGE_REGISTRY_I2_BASE_IMAGE_VERSION="$2"
shift # past argument
shift # past value
;;
--i2_image_version)
COMANAGE_REGISTRY_I2_IMAGE_VERSION="$2"
shift # past argument
shift # past value
;;
--postgres_image_version)
COMANAGE_REGISTRY_POSTGRES_IMAGE_VERSION="$2"
shift # past argument
shift # past value
;;
--slapd_base_image_version)
COMANAGE_REGISTRY_SLAPD_BASE_IMAGE_VERSION="$2"
shift # past argument
shift # past value
;;
--slapd_image_version)
COMANAGE_REGISTRY_SLAPD_IMAGE_VERSION="$2"
shift # past argument
shift # past value
;;
--slapd_proxy_image_version)
COMANAGE_REGISTRY_SLAPD_PROXY_IMAGE_VERSION="$2"
shift # past argument
shift # past value
;;
-d|--docker_registry)
DOCKER_REGISTRY="$2"
shift # past argument
shift # past value
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
declare -a inputs=(
"COMANAGE_REGISTRY_VERSION"
"COMANAGE_REGISTRY_BASE_IMAGE_VERSION"
"COMANAGE_REGISTRY_BASIC_AUTH_IMAGE_VERSION"
"COMANAGE_REGISTRY_SHIBBOLETH_SP_VERSION"
"COMANAGE_REGISTRY_SHIBBOLETH_SP_BASE_IMAGE_VERSION"
"COMANAGE_REGISTRY_SHIBBOLETH_SP_IMAGE_VERSION"
"COMANAGE_REGISTRY_MOD_AUTH_OPENIDC_IMAGE_VERSION"
"COMANAGE_REGISTRY_I2_BASE_IMAGE_VERSION"
"COMANAGE_REGISTRY_I2_IMAGE_VERSION"
"COMANAGE_REGISTRY_POSTGRES_IMAGE_VERSION"
"COMANAGE_REGISTRY_SLAPD_BASE_IMAGE_VERSION"
"COMANAGE_REGISTRY_SLAPD_IMAGE_VERSION"
"COMANAGE_REGISTRY_SLAPD_PROXY_IMAGE_VERSION"
"DOCKER_REGISTRY"
)
for input in "${inputs[@]}"
do
eval value=\$"${input}";
echo "Using $input $value"
done
pushd comanage-registry-base
TAG="${COMANAGE_REGISTRY_VERSION}-${COMANAGE_REGISTRY_BASE_IMAGE_VERSION}"
docker build \
--build-arg COMANAGE_REGISTRY_VERSION=${COMANAGE_REGISTRY_VERSION} \
-t comanage-registry-base:${TAG} .
if [[ -n "${DOCKER_REGISTRY}" ]];
then
docker tag \
comanage-registry-base:${TAG} \
${DOCKER_REGISTRY}/comanage-registry-base:${TAG}
docker push \
${DOCKER_REGISTRY}/comanage-registry-base:${TAG}
fi
popd
pushd comanage-registry-basic-auth
TAG="${COMANAGE_REGISTRY_VERSION}-basic-auth-${COMANAGE_REGISTRY_BASIC_AUTH_IMAGE_VERSION}"
docker build \
--build-arg COMANAGE_REGISTRY_VERSION=${COMANAGE_REGISTRY_VERSION} \
--build-arg COMANAGE_REGISTRY_BASE_IMAGE_VERSION=${COMANAGE_REGISTRY_BASE_IMAGE_VERSION} \
-t comanage-registry:$TAG .
if [[ -n "${DOCKER_REGISTRY}" ]];
then
docker tag \
comanage-registry:$TAG \
${DOCKER_REGISTRY}/comanage-registry:$TAG
docker push \
${DOCKER_REGISTRY}/comanage-registry:$TAG
fi
popd
pushd comanage-registry-shibboleth-sp-base
TAG="${COMANAGE_REGISTRY_SHIBBOLETH_SP_VERSION}-${COMANAGE_REGISTRY_SHIBBOLETH_SP_BASE_IMAGE_VERSION}"
docker build \
-t comanage-registry-shibboleth-sp-base:$TAG .
if [[ -n "${DOCKER_REGISTRY}" ]];
then
docker tag \
comanage-registry-shibboleth-sp-base:$TAG \
${DOCKER_REGISTRY}/comanage-registry-shibboleth-sp-base:$TAG
docker push \
${DOCKER_REGISTRY}/comanage-registry-shibboleth-sp-base:$TAG
fi
popd
pushd comanage-registry-shibboleth-sp
TAG="${COMANAGE_REGISTRY_VERSION}-shibboleth-sp-${COMANAGE_REGISTRY_SHIBBOLETH_SP_IMAGE_VERSION}"
docker build \
--build-arg COMANAGE_REGISTRY_VERSION=${COMANAGE_REGISTRY_VERSION} \
--build-arg COMANAGE_REGISTRY_BASE_IMAGE_VERSION=${COMANAGE_REGISTRY_BASE_IMAGE_VERSION} \
--build-arg COMANAGE_REGISTRY_SHIBBOLETH_SP_VERSION=${COMANAGE_REGISTRY_SHIBBOLETH_SP_VERSION} \
--build-arg COMANAGE_REGISTRY_SHIBBOLETH_SP_BASE_IMAGE_VERSION=${COMANAGE_REGISTRY_SHIBBOLETH_SP_BASE_IMAGE_VERSION} \
-t comanage-registry:$TAG .
if [[ -n "${DOCKER_REGISTRY}" ]];
then
docker tag \
comanage-registry:$TAG \
${DOCKER_REGISTRY}/comanage-registry:$TAG
docker push \
${DOCKER_REGISTRY}/comanage-registry:$TAG
fi
popd
pushd comanage-registry-mod-auth-openidc
TAG="${COMANAGE_REGISTRY_VERSION}-mod-auth-openidc-${COMANAGE_REGISTRY_MOD_AUTH_OPENIDC_IMAGE_VERSION}"
docker build \
--build-arg COMANAGE_REGISTRY_VERSION=${COMANAGE_REGISTRY_VERSION} \
--build-arg COMANAGE_REGISTRY_BASE_IMAGE_VERSION=${COMANAGE_REGISTRY_BASE_IMAGE_VERSION} \
-t comanage-registry:$TAG .
if [[ -n "${DOCKER_REGISTRY}" ]];
then
docker tag \
comanage-registry:$TAG \
${DOCKER_REGISTRY}/comanage-registry:$TAG
docker push \
${DOCKER_REGISTRY}/comanage-registry:$TAG
fi
popd
pushd comanage-registry-internet2-tier-base
TAG="${COMANAGE_REGISTRY_I2_BASE_IMAGE_VERSION}"
docker build \
-t comanage-registry-internet2-tier-base:$TAG .
if [[ -n "${DOCKER_REGISTRY}" ]];
then
docker tag \
comanage-registry-internet2-tier-base:$TAG \
${DOCKER_REGISTRY}/comanage-registry-internet2-tier-base:$TAG
docker push \
${DOCKER_REGISTRY}/comanage-registry-internet2-tier-base:$TAG
fi
popd
pushd comanage-registry-internet2-tier
TAG="${COMANAGE_REGISTRY_VERSION}-internet2-tier-${COMANAGE_REGISTRY_I2_IMAGE_VERSION}"
docker build \
--build-arg COMANAGE_REGISTRY_VERSION=${COMANAGE_REGISTRY_VERSION} \
--build-arg COMANAGE_REGISTRY_BASE_IMAGE_VERSION=${COMANAGE_REGISTRY_BASE_IMAGE_VERSION} \
--build-arg COMANAGE_REGISTRY_I2_BASE_IMAGE_VERSION=${COMANAGE_REGISTRY_I2_BASE_IMAGE_VERSION} \
-t comanage-registry:$TAG .
if [[ -n "${DOCKER_REGISTRY}" ]];
then
docker tag \
comanage-registry:$TAG \
${DOCKER_REGISTRY}/comanage-registry:$TAG
docker push \
${DOCKER_REGISTRY}/comanage-registry:$TAG
fi
popd
pushd comanage-registry-postgres
TAG="${COMANAGE_REGISTRY_POSTGRES_IMAGE_VERSION}"
docker build \
-t comanage-registry-postgres:${TAG} .
if [[ -n "${DOCKER_REGISTRY}" ]];
then
docker tag \
comanage-registry-postgres:${TAG} \
${DOCKER_REGISTRY}/comanage-registry-postgres:${TAG}
docker push \
${DOCKER_REGISTRY}/comanage-registry-postgres:${TAG}
fi
popd
pushd comanage-registry-slapd-base
TAG="${COMANAGE_REGISTRY_SLAPD_BASE_IMAGE_VERSION}"
docker build \
-t comanage-registry-slapd-base:${TAG} .
if [[ -n "${DOCKER_REGISTRY}" ]];
then
docker tag \
comanage-registry-slapd-base:${TAG} \
${DOCKER_REGISTRY}/comanage-registry-slapd-base:${TAG}
docker push \
${DOCKER_REGISTRY}/comanage-registry-slapd-base:${TAG}
fi
popd
pushd comanage-registry-slapd
TAG="${COMANAGE_REGISTRY_SLAPD_IMAGE_VERSION}"
docker build \
--build-arg COMANAGE_REGISTRY_SLAPD_BASE_IMAGE_VERSION=${COMANAGE_REGISTRY_SLAPD_BASE_IMAGE_VERSION} \
-t comanage-registry-slapd:${TAG} .
if [[ -n "${DOCKER_REGISTRY}" ]];
then
docker tag \
comanage-registry-slapd:${TAG} \
${DOCKER_REGISTRY}/comanage-registry-slapd:${TAG}
docker push \
${DOCKER_REGISTRY}/comanage-registry-slapd:${TAG}
fi
popd
pushd comanage-registry-slapd-proxy
TAG="${COMANAGE_REGISTRY_SLAPD_PROXY_IMAGE_VERSION}"
docker build \
--build-arg COMANAGE_REGISTRY_SLAPD_BASE_IMAGE_VERSION=${COMANAGE_REGISTRY_SLAPD_BASE_IMAGE_VERSION} \
-t comanage-registry-slapd-proxy:${TAG} .
if [[ -n "${DOCKER_REGISTRY}" ]];
then
docker tag \
comanage-registry-slapd-proxy:${TAG} \
${DOCKER_REGISTRY}/comanage-registry-slapd-proxy:${TAG}
docker push \
${DOCKER_REGISTRY}/comanage-registry-slapd-proxy:${TAG}
fi
popd