generated from oracle-quickstart/oci-quickstart-template
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild_mp_bundles.sh
436 lines (417 loc) · 23.6 KB
/
build_mp_bundles.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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
#!/usr/bin/env bash
# Copyright (c) 2023, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.
############################################################
# help #
############################################################
help()
{
echo "Build the Oracle Resource Manager (ORM) bundles to deploy in Marketplace"
echo
echo "Arguments: build_mp_bundles.sh -e|--edition <EE|SUITE|SE> -v|--version <12.2.1.4|14.1.1.0> -t|--type <UCM|BYOL> --all"
echo "options:"
echo "-e, --edition WebLogic edition. Supported values are EE, SUITE, or SE. Optional when --all option is provided"
echo "-v, --version WebLogic version. Supported values are 12.2.1.4 or 14.1.1.0. Optional when --all option is provided"
echo "-t, --type Type of bundle. Supported values are UCM or BYOL. Optional when --all option is provided"
echo "--all All bundles"
echo
}
if [ $# -eq 0 ]; then
help
exit 1
fi
while [ $# -ne 0 ]
do
case $1 in
-h|--help)
help
exit 0
;;
-e|--edition)
WLS_EDITION="$2"
shift
;;
-v|--version)
WLS_VERSION="$2"
shift
;;
-t|--type)
BUNDLE_TYPE="$2"
shift
;;
--all)
CREATE_ALL_BUNDLES="true"
break
;;
*)
help
exit 1
;;
esac
shift
done
# validate the input parameters
validate()
{
if [ "${CREATE_ALL_BUNDLES}" == "true" ]; then
echo "Creating all bundles.."
return
fi
if [ -z "${WLS_EDITION}" ]; then
echo "WebLogic edition is not provided"
help
exit 1
elif [ "${WLS_EDITION}" != "EE" ] && [ "${WLS_EDITION}" != "SUITE" ] && [ "${WLS_EDITION}" != "SE" ]; then
echo "Please provide valid WebLogic edition"
help
exit 1
fi
if [ -z "${WLS_VERSION}" ]; then
echo "WebLogic version is not provided"
help
exit 1
elif [ "${WLS_VERSION}" != "12.2.1.4" ] && [ "${WLS_VERSION}" != "14.1.1.0" ]; then
echo "Please provide valid WebLogic version"
help
exit 1
fi
if [ -z "${BUNDLE_TYPE}" ]; then
echo "Bundle type is not provided"
help
exit 1
elif [ "${BUNDLE_TYPE}" != "UCM" ] && [ "${BUNDLE_TYPE}" != "BYOL" ]; then
echo "Please provide valid bundle type"
help
exit 1
fi
if [ "${BUNDLE_TYPE}" == "UCM" ] && [ "${WLS_EDITION}" == "SE" ]; then
echo "Standard edition(SE) is not supported for UCM bundle. Please provide BYOL as bundle type"
help
exit 1
fi
}
#Run validation for the input parameters
validate
cd $(dirname $0)
SCRIPT_DIR=$(pwd)
echo "Cleaning wlsoci binaries folder"
rm -rf ${SCRIPT_DIR}/binaries
echo "Creating wlsoci binaries folder"
TMP_BUILD=${SCRIPT_DIR}/binaries/tmpbuild
mkdir -p ${SCRIPT_DIR}/binaries/tmpbuild
create_ucm_ee_12214()
{
cp -Rf ${SCRIPT_DIR}/../terraform/schema.yaml ${SCRIPT_DIR}/../terraform/modules ${SCRIPT_DIR}/../terraform/*.tf ${TMP_BUILD}
cp -f ${SCRIPT_DIR}/../terraform/orm/orm_provider.tf ${TMP_BUILD}/provider.tf
replace_ucm_ee_12214_variables
(cd ${TMP_BUILD}; zip -r ${SCRIPT_DIR}/binaries/wlsoci-resource-manager-ee-ucm-mp-12214.zip *; rm -Rf ${TMP_BUILD}/*)
}
create_ucm_ee_14110()
{
cp -Rf ${SCRIPT_DIR}/../terraform/modules ${SCRIPT_DIR}/../terraform/*.tf ${SCRIPT_DIR}/../terraform/schema_14110.yaml ${TMP_BUILD}
cp -f ${SCRIPT_DIR}/../terraform/orm/orm_provider.tf ${TMP_BUILD}/provider.tf
replace_ucm_ee_14110_variables
(cd ${TMP_BUILD}; zip -r ${SCRIPT_DIR}/binaries/wlsoci-resource-manager-ee-ucm-mp-14110.zip *; rm -Rf ${TMP_BUILD}/*)
}
create_ucm_suite_12214()
{
cp -Rf ${SCRIPT_DIR}/../terraform/modules ${SCRIPT_DIR}/../terraform/*.tf ${SCRIPT_DIR}/../terraform/schema.yaml ${TMP_BUILD}
cp -f ${SCRIPT_DIR}/../terraform/orm/orm_provider.tf ${TMP_BUILD}/provider.tf
replace_ucm_suite_12214_variables
(cd ${TMP_BUILD}; zip -r ${SCRIPT_DIR}/binaries/wlsoci-resource-manager-suite-ucm-mp-12214.zip *; rm -Rf ${TMP_BUILD}/*)
}
create_ucm_suite_14110()
{
cp -Rf ${SCRIPT_DIR}/../terraform/modules ${SCRIPT_DIR}/../terraform/*.tf ${SCRIPT_DIR}/../terraform/schema_14110.yaml ${TMP_BUILD}
cp -f ${SCRIPT_DIR}/../terraform/orm/orm_provider.tf ${TMP_BUILD}/provider.tf
replace_ucm_suite_14110_variables
(cd ${TMP_BUILD}; zip -r ${SCRIPT_DIR}/binaries/wlsoci-resource-manager-suite-ucm-mp-14110.zip *; rm -Rf ${TMP_BUILD}/*)
}
create_byol_ee_12214()
{
cp -Rf ${SCRIPT_DIR}/../terraform/modules ${SCRIPT_DIR}/../terraform/*.tf ${SCRIPT_DIR}/../terraform/schema.yaml ${TMP_BUILD}
cp -f ${SCRIPT_DIR}/../terraform/orm/orm_provider.tf ${TMP_BUILD}/provider.tf
replace_byol_ee_12214_variables
(cd ${TMP_BUILD}; zip -r ${SCRIPT_DIR}/binaries/wlsoci-resource-manager-ee-byol-mp-12214.zip *; rm -Rf ${TMP_BUILD}/*)
}
create_byol_ee_14110()
{
cp -Rf ${SCRIPT_DIR}/../terraform/modules ${SCRIPT_DIR}/../terraform/*.tf ${SCRIPT_DIR}/../terraform/schema_14110.yaml ${TMP_BUILD}
cp -f ${SCRIPT_DIR}/../terraform/orm/orm_provider.tf ${TMP_BUILD}/provider.tf
replace_byol_ee_14110_variables
(cd ${TMP_BUILD}; zip -r ${SCRIPT_DIR}/binaries/wlsoci-resource-manager-ee-byol-mp-14110.zip *; rm -Rf ${TMP_BUILD}/*)
}
create_byol_suite_12214()
{
cp -Rf ${SCRIPT_DIR}/../terraform/modules ${SCRIPT_DIR}/../terraform/*.tf ${SCRIPT_DIR}/../terraform/schema.yaml ${TMP_BUILD}
cp -f ${SCRIPT_DIR}/../terraform/orm/orm_provider.tf ${TMP_BUILD}/provider.tf
replace_byol_suite_12214_variables
(cd ${TMP_BUILD}; zip -r ${SCRIPT_DIR}/binaries/wlsoci-resource-manager-suite-byol-mp-12214.zip *; rm -Rf ${TMP_BUILD}/*)
}
create_byol_suite_14110()
{
cp -Rf ${SCRIPT_DIR}/../terraform/modules ${SCRIPT_DIR}/../terraform/*.tf ${SCRIPT_DIR}/../terraform/schema_14110.yaml ${TMP_BUILD}
cp -f ${SCRIPT_DIR}/../terraform/orm/orm_provider.tf ${TMP_BUILD}/provider.tf
replace_byol_suite_14110_variables
(cd ${TMP_BUILD}; zip -r ${SCRIPT_DIR}/binaries/wlsoci-resource-manager-suite-byol-mp-14110.zip *; rm -Rf ${TMP_BUILD}/*)
}
create_byol_standard_12214()
{
cp -Rf ${SCRIPT_DIR}/../terraform/modules ${SCRIPT_DIR}/../terraform/*.tf ${SCRIPT_DIR}/../terraform/schema.yaml ${TMP_BUILD}
cp -f ${SCRIPT_DIR}/../terraform/orm/orm_provider.tf ${TMP_BUILD}/provider.tf
replace_byol_se_12214_variables
(cd ${TMP_BUILD}; zip -r ${SCRIPT_DIR}/binaries/wlsoci-resource-manager-se-byol-mp-12214.zip *; rm -Rf ${TMP_BUILD}/*)
}
create_byol_standard_14110()
{
cp -Rf ${SCRIPT_DIR}/../terraform/modules ${SCRIPT_DIR}/../terraform/*.tf ${SCRIPT_DIR}/../terraform/schema_14110.yaml ${TMP_BUILD}
cp -f ${SCRIPT_DIR}/../terraform/orm/orm_provider.tf ${TMP_BUILD}/provider.tf
replace_byol_se_14110_variables
(cd ${TMP_BUILD}; zip -r ${SCRIPT_DIR}/binaries/wlsoci-resource-manager-se-byol-mp-14110.zip *; rm -Rf ${TMP_BUILD}/*)
}
replace_byol_ee_12214_variables()
{
export TF_VAR_FILE=${SCRIPT_DIR}/../terraform/images/mp_image_ee_byol.tfvars
get_mp_values
sed -i '/variable "tf_script_version" {/!b;n;n;n;cdefault = '"$tf_script_version"'' ${TMP_BUILD}/variables.tf
sed -i '/variable "instance_image_id" {/!b;n;n;n;cdefault = '"$instance_image_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "use_marketplace_image" {/!b;n;n;n;cdefault = '"true"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_id" {/!b;n;n;n;cdefault = '"$listing_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_resource_version" {/!b;n;n;n;cdefault = '"$listing_resource_version"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "ucm_instance_image_id" {/!b;n;n;n;cdefault = '"${ucm_instance_image_id}"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "ucm_listing_id" {/!b;n;n;n;cdefault = '"$ucm_listing_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "ucm_listing_resource_version" {/!b;n;n;n;cdefault = '"$ucm_listing_resource_version"'' ${TMP_BUILD}/mp_variables.tf
sed -i 's/#- ${instance_image_id}/- ${instance_image_id}/' ${TMP_BUILD}/schema.yaml
sed -i 's/#- ${image_mode}/- ${image_mode}/' ${TMP_BUILD}/schema.yaml
sed -i 's/#- ${terms_and_conditions}/- ${terms_and_conditions}/' ${TMP_BUILD}/schema.yaml
sed -i ':a;$!{N;ba};s/- ${image_mode}/#- ${image_mode}/2' ${TMP_BUILD}/schema.yaml
sed -i ':a;$!{N;ba};s/- ${terms_and_conditions}/#- ${terms_and_conditions}/2' ${TMP_BUILD}/schema.yaml
sed -i '/main_mktpl_image/ { n; s/ocid = ""/ocid = '"${instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
sed -i '/ucm_image/ { n; s/ocid = ""/ocid = '"${ucm_instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
}
replace_byol_ee_14110_variables()
{
export TF_VAR_FILE=${SCRIPT_DIR}/../terraform/images/mp_image_ee_byol.tfvars
get_mp_values
sed -i '/variable "tf_script_version" {/!b;n;n;n;cdefault = '"$tf_script_version"'' ${TMP_BUILD}/variables.tf
sed -i '/variable "wls_version" {/!b;n;n;n;cdefault = \"14.1.1.0\"' ${TMP_BUILD}/weblogic_variables.tf
sed -i '/variable "instance_image_id" {/!b;n;n;n;cdefault = '"$instance_image_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "use_marketplace_image" {/!b;n;n;n;cdefault = '"true"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_id" {/!b;n;n;n;cdefault = '"$listing_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_resource_version" {/!b;n;n;n;cdefault = '"$listing_resource_version"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "ucm_instance_image_id" {/!b;n;n;n;cdefault = '"${ucm_instance_image_id}"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "ucm_listing_id" {/!b;n;n;n;cdefault = '"$ucm_listing_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "ucm_listing_resource_version" {/!b;n;n;n;cdefault = '"$ucm_listing_resource_version"'' ${TMP_BUILD}/mp_variables.tf
sed -i 's/#- ${instance_image_id}/- ${instance_image_id}/' ${TMP_BUILD}/schema_14110.yaml
sed -i 's/#- ${image_mode}/- ${image_mode}/' ${TMP_BUILD}/schema_14110.yaml
sed -i 's/#- ${terms_and_conditions}/- ${terms_and_conditions}/' ${TMP_BUILD}/schema_14110.yaml
sed -i ':a;$!{N;ba};s/- ${image_mode}/#- ${image_mode}/2' ${TMP_BUILD}/schema_14110.yaml
sed -i ':a;$!{N;ba};s/- ${terms_and_conditions}/#- ${terms_and_conditions}/2' ${TMP_BUILD}/schema_14110.yaml
sed -i '/main_mktpl_image/ { n; s/ocid = ""/ocid = '"${instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
sed -i '/ucm_image/ { n; s/ocid = ""/ocid = '"${ucm_instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
}
replace_byol_se_12214_variables()
{
export TF_VAR_FILE=${SCRIPT_DIR}/../terraform/images/mp_image_se_byol.tfvars
get_mp_values
sed -i '/variable "tf_script_version" {/!b;n;n;n;cdefault = '"$tf_script_version"'' ${TMP_BUILD}/variables.tf
sed -i 's/default = "EE"/default = "SE"/' ${TMP_BUILD}/edition.tf
sed -i '/variable "instance_image_id" {/!b;n;n;n;cdefault = '"$instance_image_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "use_marketplace_image" {/!b;n;n;n;cdefault = '"true"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_id" {/!b;n;n;n;cdefault = '"$listing_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_resource_version" {/!b;n;n;n;cdefault = '"$listing_resource_version"'' ${TMP_BUILD}/mp_variables.tf
sed -i 's/#- ${instance_image_id}/- ${instance_image_id}/' ${TMP_BUILD}/schema.yaml
sed -i 's/#- ${use_autoscaling}/- ${use_autoscaling}/' ${TMP_BUILD}/schema.yaml
sed -i ':a;$!{N;ba};s/- ${use_autoscaling}/#- ${use_autoscaling}/1' ${TMP_BUILD}/schema.yaml
sed -i '/main_mktpl_image/ { n; s/ocid = ""/ocid = '"${instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
export TF_VAR_FILE=${SCRIPT_DIR}/../terraform/images/mp_image_ee_byol.tfvars
get_mp_values
sed -i '/ucm_image/ { n; s/ocid = ""/ocid = '"${ucm_instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
}
replace_byol_se_14110_variables()
{
export TF_VAR_FILE=${SCRIPT_DIR}/../terraform/images/mp_image_se_byol.tfvars
get_mp_values
sed -i '/variable "tf_script_version" {/!b;n;n;n;cdefault = '"$tf_script_version"'' ${TMP_BUILD}/variables.tf
sed -i 's/default = "EE"/default = "SE"/' ${TMP_BUILD}/edition.tf
sed -i '/variable "wls_version" {/!b;n;n;n;cdefault = \"14.1.1.0\"' ${TMP_BUILD}/weblogic_variables.tf
sed -i '/variable "instance_image_id" {/!b;n;n;n;cdefault = '"$instance_image_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "use_marketplace_image" {/!b;n;n;n;cdefault = '"true"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_id" {/!b;n;n;n;cdefault = '"$listing_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_resource_version" {/!b;n;n;n;cdefault = '"$listing_resource_version"'' ${TMP_BUILD}/mp_variables.tf
sed -i 's/#- ${instance_image_id}/- ${instance_image_id}/' ${TMP_BUILD}/schema_14110.yaml
sed -i 's/#- ${use_autoscaling}/- ${use_autoscaling}/' ${TMP_BUILD}/schema_14110.yaml
sed -i ':a;$!{N;ba};s/- ${use_autoscaling}/#- ${use_autoscaling}/1' ${TMP_BUILD}/schema_14110.yaml
sed -i '/main_mktpl_image/ { n; s/ocid = ""/ocid = '"${instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
export TF_VAR_FILE=${SCRIPT_DIR}/../terraform/images/mp_image_ee_byol.tfvars
get_mp_values
sed -i '/ucm_image/ { n; s/ocid = ""/ocid = '"${ucm_instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
}
replace_byol_suite_12214_variables()
{
export TF_VAR_FILE=${SCRIPT_DIR}/../terraform/images/mp_image_suite_byol.tfvars
get_mp_values
sed -i '/variable "tf_script_version" {/!b;n;n;n;cdefault = '"$tf_script_version"'' ${TMP_BUILD}/variables.tf
sed -i 's/default = "EE"/default = "SUITE"/' ${TMP_BUILD}/edition.tf
sed -i '/variable "instance_image_id" {/!b;n;n;n;cdefault = '"$instance_image_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "use_marketplace_image" {/!b;n;n;n;cdefault = '"true"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_id" {/!b;n;n;n;cdefault = '"$listing_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_resource_version" {/!b;n;n;n;cdefault = '"$listing_resource_version"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "ucm_instance_image_id" {/!b;n;n;n;cdefault = '"${ucm_instance_image_id}"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "ucm_listing_id" {/!b;n;n;n;cdefault = '"$ucm_listing_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "ucm_listing_resource_version" {/!b;n;n;n;cdefault = '"$ucm_listing_resource_version"'' ${TMP_BUILD}/mp_variables.tf
sed -i 's/#- ${instance_image_id}/- ${instance_image_id}/' ${TMP_BUILD}/schema.yaml
sed -i 's/#- ${image_mode}/- ${image_mode}/' ${TMP_BUILD}/schema.yaml
sed -i 's/#- ${terms_and_conditions}/- ${terms_and_conditions}/' ${TMP_BUILD}/schema.yaml
sed -i ':a;$!{N;ba};s/- ${image_mode}/#- ${image_mode}/2' ${TMP_BUILD}/schema.yaml
sed -i ':a;$!{N;ba};s/- ${terms_and_conditions}/#- ${terms_and_conditions}/2' ${TMP_BUILD}/schema.yaml
sed -i '/main_mktpl_image/ { n; s/ocid = ""/ocid = '"${instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
sed -i '/ucm_image/ { n; s/ocid = ""/ocid = '"${ucm_instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
}
replace_byol_suite_14110_variables()
{
export TF_VAR_FILE=${SCRIPT_DIR}/../terraform/images/mp_image_suite_byol.tfvars
get_mp_values
sed -i '/variable "tf_script_version" {/!b;n;n;n;cdefault = '"$tf_script_version"'' ${TMP_BUILD}/variables.tf
sed -i 's/default = "EE"/default = "SUITE"/' ${TMP_BUILD}/edition.tf
sed -i '/variable "wls_version" {/!b;n;n;n;cdefault = \"14.1.1.0\"' ${TMP_BUILD}/weblogic_variables.tf
sed -i '/variable "instance_image_id" {/!b;n;n;n;cdefault = '"$instance_image_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "use_marketplace_image" {/!b;n;n;n;cdefault = '"true"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_id" {/!b;n;n;n;cdefault = '"$listing_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_resource_version" {/!b;n;n;n;cdefault = '"$listing_resource_version"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "ucm_instance_image_id" {/!b;n;n;n;cdefault = '"${ucm_instance_image_id}"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "ucm_listing_id" {/!b;n;n;n;cdefault = '"$ucm_listing_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "ucm_listing_resource_version" {/!b;n;n;n;cdefault = '"$ucm_listing_resource_version"'' ${TMP_BUILD}/mp_variables.tf
sed -i 's/#- ${instance_image_id}/- ${instance_image_id}/' ${TMP_BUILD}/schema_14110.yaml
sed -i 's/#- ${image_mode}/- ${image_mode}/' ${TMP_BUILD}/schema_14110.yaml
sed -i 's/#- ${terms_and_conditions}/- ${terms_and_conditions}/' ${TMP_BUILD}/schema_14110.yaml
sed -i ':a;$!{N;ba};s/- ${image_mode}/#- ${image_mode}/2' ${TMP_BUILD}/schema_14110.yaml
sed -i ':a;$!{N;ba};s/- ${terms_and_conditions}/#- ${terms_and_conditions}/2' ${TMP_BUILD}/schema_14110.yaml
sed -i '/main_mktpl_image/ { n; s/ocid = ""/ocid = '"${instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
sed -i '/ucm_image/ { n; s/ocid = ""/ocid = '"${ucm_instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
}
replace_ucm_suite_12214_variables()
{
export TF_VAR_FILE=${SCRIPT_DIR}/../terraform/images/mp_image_suite_ucm.tfvars
get_mp_values
sed -i '/variable "tf_script_version" {/!b;n;n;n;cdefault = '"$tf_script_version"'' ${TMP_BUILD}/variables.tf
sed -i 's/default = "EE"/default = "SUITE"/' ${TMP_BUILD}/edition.tf
sed -i '/variable "instance_image_id" {/!b;n;n;n;cdefault = '"$instance_image_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "use_marketplace_image" {/!b;n;n;n;cdefault = '"true"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_id" {/!b;n;n;n;cdefault = '"$listing_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_resource_version" {/!b;n;n;n;cdefault = '"$listing_resource_version"'' ${TMP_BUILD}/mp_variables.tf
sed -i 's/#- ${instance_image_id}/- ${instance_image_id}/' ${TMP_BUILD}/schema.yaml
sed -i '/main_mktpl_image/ { n; s/ocid = ""/ocid = '"${instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
export TF_VAR_FILE=${SCRIPT_DIR}/../terraform/images/mp_image_suite_byol.tfvars
get_mp_values
sed -i '/ucm_image/ { n; s/ocid = ""/ocid = '"${ucm_instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
}
replace_ucm_suite_14110_variables()
{
export TF_VAR_FILE=${SCRIPT_DIR}/../terraform/images/mp_image_suite_ucm.tfvars
get_mp_values
sed -i '/variable "tf_script_version" {/!b;n;n;n;cdefault = '"$tf_script_version"'' ${TMP_BUILD}/variables.tf
sed -i 's/default = "EE"/default = "SUITE"/' ${TMP_BUILD}/edition.tf
sed -i '/variable "wls_version" {/!b;n;n;n;cdefault = \"14.1.1.0\"' ${TMP_BUILD}/weblogic_variables.tf
sed -i '/variable "instance_image_id" {/!b;n;n;n;cdefault = '"$instance_image_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "use_marketplace_image" {/!b;n;n;n;cdefault = '"true"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_id" {/!b;n;n;n;cdefault = '"$listing_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_resource_version" {/!b;n;n;n;cdefault = '"$listing_resource_version"'' ${TMP_BUILD}/mp_variables.tf
sed -i 's/#- ${instance_image_id}/- ${instance_image_id}/' ${TMP_BUILD}/schema_14110.yaml
sed -i '/main_mktpl_image/ { n; s/ocid = ""/ocid = '"${instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
export TF_VAR_FILE=${SCRIPT_DIR}/../terraform/images/mp_image_suite_byol.tfvars
get_mp_values
sed -i '/ucm_image/ { n; s/ocid = ""/ocid = '"${ucm_instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
}
replace_ucm_ee_12214_variables()
{
export TF_VAR_FILE=${SCRIPT_DIR}/../terraform/images/mp_image_ee_ucm.tfvars
get_mp_values
sed -i '/variable "tf_script_version" {/!b;n;n;n;cdefault = '"$tf_script_version"'' ${TMP_BUILD}/variables.tf
sed -i '/variable "instance_image_id" {/!b;n;n;n;cdefault = '"$instance_image_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "use_marketplace_image" {/!b;n;n;n;cdefault = '"true"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_id" {/!b;n;n;n;cdefault = '"$listing_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_resource_version" {/!b;n;n;n;cdefault = '"$listing_resource_version"'' ${TMP_BUILD}/mp_variables.tf
sed -i 's/#- ${instance_image_id}/- ${instance_image_id}/' ${TMP_BUILD}/schema.yaml
sed -i '/main_mktpl_image/ { n; s/ocid = ""/ocid = '"${instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
export TF_VAR_FILE=${SCRIPT_DIR}/../terraform/images/mp_image_ee_byol.tfvars
get_mp_values
sed -i '/ucm_image/ { n; s/ocid = ""/ocid = '"${ucm_instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
}
replace_ucm_ee_14110_variables()
{
export TF_VAR_FILE=${SCRIPT_DIR}/../terraform/images/mp_image_ee_ucm.tfvars
get_mp_values
sed -i '/variable "tf_script_version" {/!b;n;n;n;cdefault = '"$tf_script_version"'' ${TMP_BUILD}/variables.tf
sed -i '/variable "wls_version" {/!b;n;n;n;cdefault = \"14.1.1.0\"' ${TMP_BUILD}/weblogic_variables.tf
sed -i '/variable "instance_image_id" {/!b;n;n;n;cdefault = '"$instance_image_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "use_marketplace_image" {/!b;n;n;n;cdefault = '"true"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_id" {/!b;n;n;n;cdefault = '"$listing_id"'' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "listing_resource_version" {/!b;n;n;n;cdefault = '"$listing_resource_version"'' ${TMP_BUILD}/mp_variables.tf
sed -i 's/#- ${instance_image_id}/- ${instance_image_id}/' ${TMP_BUILD}/schema_14110.yaml
sed -i '/main_mktpl_image/ { n; s/ocid = ""/ocid = '"${instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
export TF_VAR_FILE=${SCRIPT_DIR}/../terraform/images/mp_image_ee_byol.tfvars
get_mp_values
sed -i '/ucm_image/ { n; s/ocid = ""/ocid = '"${ucm_instance_image_id}"'/; }' ${TMP_BUILD}/oci_images.tf
}
get_mp_values()
{
export tf_script_version=`cat ${TF_VAR_FILE} | grep -w "tf_script_version" | cut -d'=' -f2`
export listing_id=`cat ${TF_VAR_FILE} | grep -w "listing_id" | cut -d'=' -f2`
export listing_resource_version=`cat ${TF_VAR_FILE} | grep -w "listing_resource_version" | cut -d'=' -f2`
export instance_image_id=`cat ${TF_VAR_FILE} | grep -w "instance_image_id" | cut -d'=' -f2`
export ucm_listing_id=`cat ${TF_VAR_FILE} | grep -w "ucm_listing_id" | cut -d'=' -f2`
export ucm_listing_resource_version=`cat ${TF_VAR_FILE} | grep -w "ucm_listing_resource_version" | cut -d'=' -f2`
export ucm_instance_image_id=`cat ${TF_VAR_FILE} | grep -w "ucm_instance_image_id" | cut -d'=' -f2`
}
if [ "${CREATE_ALL_BUNDLES}" == "true" ]; then
create_ucm_ee_12214
create_ucm_ee_14110
create_ucm_suite_12214
create_ucm_suite_14110
create_byol_ee_12214
create_byol_ee_14110
create_byol_suite_12214
create_byol_suite_14110
create_byol_standard_12214
create_byol_standard_14110
else
if [ "${BUNDLE_TYPE}" == "UCM" ]; then
if [ "${WLS_EDITION}" == "EE" ]; then
if [ "${WLS_VERSION}" == "12.2.1.4" ]; then
create_ucm_ee_12214
else
create_ucm_ee_14110
fi
elif [ "${WLS_EDITION}" == "SUITE" ]; then
if [ "${WLS_VERSION}" == "12.2.1.4" ]; then
create_ucm_suite_12214
else
create_ucm_suite_14110
fi
fi
else
if [ "${WLS_EDITION}" == "EE" ]; then
if [ "${WLS_VERSION}" == "12.2.1.4" ]; then
create_byol_ee_12214
else
create_byol_ee_14110
fi
elif [ "${WLS_EDITION}" == "SUITE" ]; then
if [ "${WLS_VERSION}" == "12.2.1.4" ]; then
create_byol_suite_12214
else
create_byol_suite_14110
fi
else
if [ "${WLS_VERSION}" == "12.2.1.4" ]; then
create_byol_se_12214
else
create_byol_se_14110
fi
fi
fi
fi
#cleanup
rm -Rf $TMP_BUILD
exit 0