generated from oracle-quickstart/oci-quickstart-template
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild_orm_dev.sh
141 lines (123 loc) · 4.19 KB
/
build_orm_dev.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
#!/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.
#######################################################################################################
# Build the Oracle Resource Manager (ORM) bundles for developers to test new features or bug fixes #
#######################################################################################################
############################################################
# help #
############################################################
help()
{
echo "Build the Oracle Resource Manager (ORM) bundles for developers to deploy in Marketplace"
echo
echo "Arguments: build_orm_dev.sh -v|--version <12.2.1.4|14.1.1.0> -t|--scripts_version --all"
echo "options:"
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, --scripts_version VM scripts version"
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
;;
-v|--version)
WLS_VERSION="$2"
shift
;;
-t|--scripts_version)
SCRIPTS_VERSION="$2"
shift
;;
--all)
CREATE_ALL_BUNDLES="true"
break
;;
*)
help
exit 1
;;
esac
shift
done
# validate the input parameters
validate()
{
if [ -z "${SCRIPTS_VERSION}" ]; then
echo "vm scripts version is not provided"
help
exit 1
fi
if [ "${CREATE_ALL_BUNDLES}" == "true" ]; then
echo "Creating all bundles.."
return
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
}
#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_12214_bundle()
{
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_12214_variables
(cd ${TMP_BUILD}; zip -r ${SCRIPT_DIR}/binaries/wlsoci-resource-manager-ee-12214.zip *; rm -Rf ${TMP_BUILD}/*)
}
create_14110_bundle()
{
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_14110_variables
(cd ${TMP_BUILD}; zip -r ${SCRIPT_DIR}/binaries/wlsoci-resource-manager-ee-14110.zip *; rm -Rf ${TMP_BUILD}/*)
}
#need to change it to false after RM UI fix
replace_12214_variables()
{
sed -i '/variable "generate_dg_tag" {/!b;n;n;n;cdefault = false' ${TMP_BUILD}/variables.tf
sed -i '/variable "use_marketplace_image" {/!b;n;n;n;cdefault = false' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "tf_script_version" {/!b;n;n;n;cdefault = \"'"$SCRIPTS_VERSION"'\"' ${TMP_BUILD}/variables.tf
}
#need to change it to false after RM UI fix
replace_14110_variables()
{
sed -i '/variable "generate_dg_tag" {/!b;n;n;n;cdefault = false' ${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 "use_marketplace_image" {/!b;n;n;n;cdefault = false' ${TMP_BUILD}/mp_variables.tf
sed -i '/variable "tf_script_version" {/!b;n;n;n;cdefault = \"'"$SCRIPTS_VERSION"'\"' ${TMP_BUILD}/variables.tf
}
if [ "${CREATE_ALL_BUNDLES}" == "true" ]; then
create_12214_bundle
create_14110_bundle
else
if [ "${WLS_VERSION}" == "12.2.1.4" ]; then
create_12214_bundle
else
create_14110_bundle
fi
fi
#cleanup
rm -Rf $TMP_BUILD
exit 0