generated from oracle-quickstart/oci-quickstart-template
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild_cli.sh
93 lines (77 loc) · 2.46 KB
/
build_cli.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
#!/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 CLI bundle to run SRG dev tests #
############################################################
############################################################
# help #
############################################################
help()
{
echo
echo "Arguments: build_cli.sh -t|--scripts_version"
echo "options:"
echo "-t, --scripts_version VM scripts version"
echo
}
if [ $# -eq 0 ]; then
help
exit 1
fi
while [ $# -ne 0 ]
do
case $1 in
-h|--help)
help
exit 0
;;
-t|--scripts_version)
SCRIPTS_VERSION="$2"
shift
;;
*)
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
}
#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_cli_bundle()
{
cp -Rf ${SCRIPT_DIR}/../terraform/modules ${SCRIPT_DIR}/../terraform/edition.tf ${SCRIPT_DIR}/../terraform/*.tf ${SCRIPT_DIR}/../terraform/images ${TMP_BUILD}
rm ${TMP_BUILD}/modules/validators/stack_validators.tf
replace_variables
(cd ${TMP_BUILD}; zip -r ${SCRIPT_DIR}/binaries/wlsoci-terraform.zip *; rm -Rf ${TMP_BUILD}/*)
}
#need to change it to false after RM UI fix
replace_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
sed -i '/variable "is_rms_private_endpoint_required" {/!b;n;n;n;cdefault = false' ${TMP_BUILD}/variables.tf
sed -i '/variable "is_bastion_instance_required" {/!b;n;n;n;cdefault = true' ${TMP_BUILD}/bastion_variables.tf
}
create_cli_bundle
#cleanup
rm -Rf $TMP_BUILD
exit 0