Skip to content

Commit 938a235

Browse files
committed
Merge branch 'develop' into initconttests
2 parents 8087fc5 + 4391ebe commit 938a235

File tree

21 files changed

+590
-62
lines changed

21 files changed

+590
-62
lines changed

integration-tests/src/test/java/oracle/kubernetes/operator/utils/Domain.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,7 +1682,7 @@ private void copyCreateDomainPy() throws IOException {
16821682
.toPath(),
16831683
new File(
16841684
BaseTest.getResultDir()
1685-
+ "/samples/scripts/create-fmw-infrastructure-domain/common/createFMWDomain.py")
1685+
+ "/samples/scripts/create-fmw-infrastructure-domain/domain-home-on-pv/common/createFMWDomain.py")
16861686
.toPath(),
16871687
StandardCopyOption.REPLACE_EXISTING);
16881688
} else {
@@ -1721,7 +1721,7 @@ private String prepareCmdToCallCreateDomainScript(String outputDir) {
17211721
.append(" -k -i ");
17221722
} else if (domainMap.containsKey("rcuDatabaseURL")) {
17231723
createDomainScriptCmd.append(
1724-
"/samples/scripts/create-fmw-infrastructure-domain/create-domain.sh -v -i ");
1724+
"/samples/scripts/create-fmw-infrastructure-domain/domain-home-on-pv/create-domain.sh -v -i ");
17251725
} else {
17261726
createDomainScriptCmd.append(
17271727
"/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain.sh -v -i ");

integration-tests/src/test/java/oracle/kubernetes/operator/utils/JrfDomain.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ private void updateDomainMapForJrf(boolean adminPortEnabled) throws Exception {
6969
if (adminPortEnabled) {
7070
String createDomainScript =
7171
BaseTest.getResultDir()
72-
+ "/samples/scripts/create-fmw-infrastructure-domain/wlst/create-domain-script.sh";
72+
+ "/samples/scripts/create-fmw-infrastructure-domain/domain-home-on-pv/wlst/create-domain-script.sh";
7373
TestUtils.replaceStringInFile(
7474
createDomainScript,
7575
"-managedNameBase ",

kubernetes/samples/scripts/create-fmw-infrastructure-domain/create-domain.sh renamed to kubernetes/samples/scripts/create-fmw-infrastructure-domain/domain-home-on-pv/create-domain.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
# Initialize
2222
script="${BASH_SOURCE[0]}"
2323
scriptDir="$( cd "$( dirname "${script}" )" && pwd )"
24-
source ${scriptDir}/../common/utility.sh
25-
source ${scriptDir}/../common/validate.sh
24+
source ${scriptDir}/../../common/utility.sh
25+
source ${scriptDir}/../../common/validate.sh
2626

2727
function usage {
2828
echo usage: ${script} -o dir -i file [-e] [-v] [-h]
@@ -118,7 +118,7 @@ function initialize {
118118
validationError "The template file ${deleteJobInput} for deleting a WebLogic domain was not found"
119119
fi
120120

121-
dcrInput="${scriptDir}/../common/domain-template.yaml"
121+
dcrInput="${scriptDir}/../../common/domain-template.yaml"
122122
if [ ! -f ${dcrInput} ]; then
123123
validationError "The template file ${dcrInput} for creating the domain resource was not found"
124124
fi
Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
#!/bin/bash
2+
# Copyright 2018, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
3+
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
4+
#
5+
# Description:
6+
#
7+
# This script generates a domain by calling the WebLogic Deploy Tool (WDT)
8+
# bin/createDomain.sh script.
9+
#
10+
# It first installs WDT using the given download URLs, and then runs it using the
11+
# given Oracle home, WDT model file, WDT vars file, etc.
12+
#
13+
# Usage:
14+
#
15+
# Export customized values for the input shell environment variables as needed
16+
# before calling this script.
17+
#
18+
# Outputs:
19+
#
20+
# WDT install: WDT_DIR/weblogic-deploy/...
21+
#
22+
# Copy of wdt model: WDT_DIR/$(basename WDT_MODEL_FILE)
23+
# Copy of wdt vars: WDT_DIR/$(basename WDT_VAR_FILE)
24+
#
25+
# WDT logs: WDT_DIR/weblogic-deploy/logs/...
26+
# WDT stdout: WDT_DIR/createDomain.sh.out
27+
#
28+
# WebLogic domain home: DOMAIN_HOME_DIR
29+
# default: /shared/domains/<domainUID>
30+
#
31+
# Input environment variables:
32+
#
33+
# ORACLE_HOME Oracle home with a WebLogic install.
34+
# default: /u01/oracle
35+
#
36+
# WDT_MODEL_FILE Full path to WDT model file.
37+
# default: the directory that contains this script
38+
# plus "/wdt_model.yaml"
39+
#
40+
# WDT_VAR_FILE Full path to WDT variable file (java properties format).
41+
# default: the directory that contains this script
42+
# plus "/create-domain-inputs.yaml"
43+
#
44+
# WDT_INSTALL_ZIP_FILE Filename of WDT install zip.
45+
# default: weblogic-deploy.zip
46+
#
47+
# WDT_INSTALL_ZIP_URL URL for downloading WDT install zip
48+
# default: https://github.com/oracle/weblogic-deploy-tooling/releases/download/weblogic-deploy-tooling-0.24/$WDT_INSTALL_ZIP_FILE
49+
#
50+
# https_proxy Proxy for downloading WDT_INSTALL_ZIP_URL.
51+
# default: "http://www-proxy-hqdc.us.oracle.com:80"
52+
# (If set to empty the script will try with no proxy.)
53+
#
54+
# https_proxy2 Alternate proxy for downloading WDT_INSTALL_ZIP_URL
55+
# default: ""
56+
# (If set to empty the script will try with no proxy.)
57+
#
58+
# WDT_DIR Target location to install and run WDT, and to keep a copy of
59+
# $WDT_MODEL_FILE and $WDT_MODEL_VARS. Also the location
60+
# of WDT log files.
61+
# default: /shared/wdt
62+
#
63+
# DOMAIN_HOME_DIR Target location for generated domain.
64+
#
65+
66+
# Initialize globals
67+
68+
export ORACLE_HOME=${ORACLE_HOME:-/u01/oracle}
69+
70+
SCRIPTPATH="$( cd "$(dirname "$0")" > /dev/null 2>&1 ; pwd -P )"
71+
WDT_MODEL_FILE=${WDT_MODEL_FILE:-"$SCRIPTPATH/wdt_model.yaml"}
72+
WDT_VAR_FILE=${WDT_VAR_FILE:-"$SCRIPTPATH/create-domain-inputs.yaml"}
73+
74+
WDT_DIR=${WDT_DIR:-/shared/wdt}
75+
76+
WDT_INSTALL_ZIP_FILE="${WDT_INSTALL_ZIP_FILE:-weblogic-deploy.zip}"
77+
WDT_INSTALL_ZIP_URL=${WDT_INSTALL_ZIP_URL:-"https://github.com/oracle/weblogic-deploy-tooling/releases/download/weblogic-deploy-tooling-0.24/$WDT_INSTALL_ZIP_FILE"}
78+
79+
# using "-" instead of ":-" in case proxy vars are explicitly set to "".
80+
https_proxy=${https_proxy-""}
81+
https_proxy2=${https_proxy2-"http://www-proxy-hqdc.us.oracle.com:80"}
82+
83+
# Define functions
84+
85+
function setup_wdt_shared_dir {
86+
mkdir -p $WDT_DIR || return 1
87+
}
88+
89+
function install_wdt {
90+
#
91+
# Download $WDT_INSTALL_ZIP_FILE from $WDT_INSTALL_ZIP_URL into $WDT_DIR using
92+
# proxies https_proxy or https_proxy2, then unzip the zip file in $WDT_DIR.
93+
#
94+
95+
local save_dir=`pwd`
96+
cd $WDT_DIR || return 1
97+
98+
local curl_res=1
99+
for proxy in "${https_proxy}" "${https_proxy2}"; do
100+
echo @@ "Info: Downloading $WDT_INSTALL_ZIP_URL with https_proxy=\"$proxy\""
101+
https_proxy="${proxy}" \
102+
curl --silent --show-error --connect-timeout 10 -O -L $WDT_INSTALL_ZIP_URL
103+
curl_res=$?
104+
[ $curl_res -eq 0 ] && break
105+
done
106+
107+
if [ $curl_res -ne 0 ] || [ ! -f $WDT_INSTALL_ZIP_FILE ]; then
108+
cd $save_dir
109+
echo @@ "Error: Download failed or $WDT_INSTALL_ZIP_FILE not found."
110+
return 1
111+
fi
112+
113+
echo @@ "Info: Archive downloaded to $WDT_DIR/$WDT_INSTALL_ZIP_FILE, about to unzip via 'jar xf'."
114+
115+
jar xf $WDT_INSTALL_ZIP_FILE
116+
local jar_res=$?
117+
118+
cd $save_dir
119+
120+
if [ $jar_res -ne 0 ]; then
121+
echo @@ "Error: Install failed while unzipping $WDT_DIR/$WDT_INSTALL_ZIP_FILE"
122+
return $jar_res
123+
fi
124+
125+
if [ ! -d "$WDT_DIR/weblogic-deploy/bin" ]; then
126+
echo @@ "Error: Install failed: directory '$WDT_DIR/weblogic-deploy/bin' not found."
127+
return 1
128+
fi
129+
130+
chmod 775 $WDT_DIR/weblogic-deploy/bin/* || return 1
131+
132+
echo @@ "Info: Install succeeded, wdt install is in the $WDT_DIR/weblogic-deploy directory."
133+
return 0
134+
}
135+
136+
function run_wdt {
137+
#
138+
# Run WDT using WDT_VAR_FILE, WDT_MODEL_FILE, and ORACLE_HOME.
139+
# Output:
140+
# - result domain will be in DOMAIN_HOME_DIR
141+
# - logging output is in $WDT_DIR/createDomain.sh.out and $WDT_DIR/weblogic-deploy/logs
142+
# - WDT_VAR_FILE & WDT_MODEL_FILE will be copied to WDT_DIR.
143+
#
144+
145+
# Input files and directories.
146+
147+
local inputs_orig="$WDT_VAR_FILE"
148+
local model_orig="$WDT_MODEL_FILE"
149+
local oracle_home="$ORACLE_HOME"
150+
local wdt_bin_dir="$WDT_DIR/weblogic-deploy/bin"
151+
local wdt_createDomain_script="$wdt_bin_dir/createDomain.sh"
152+
153+
local domain_home_dir="$DOMAIN_HOME_DIR"
154+
if [ -z "${domain_home_dir}" ]; then
155+
local domain_dir="/shared/domains"
156+
local domain_uid=`egrep 'domainUID' $inputs_orig | awk '{print $2}'`
157+
local domain_home_dir=$domain_dir/$domain_uid
158+
fi
159+
160+
echo domain_home_dir = $domain_home_dir
161+
162+
# Output files and directories.
163+
164+
local inputs_final=$WDT_DIR/$(basename "$inputs_orig")
165+
local model_final=$WDT_DIR/$(basename "$model_orig")
166+
local out_file=$WDT_DIR/createDomain.sh.out
167+
local wdt_log_dir="$WDT_DIR/weblogic-deploy/logs"
168+
169+
echo @@ "Info: About to run WDT createDomain.sh"
170+
171+
for directory in wdt_bin_dir SCRIPTPATH WDT_DIR oracle_home; do
172+
if [ ! -d "${!directory}" ]; then
173+
echo @@ "Error: Could not find ${directory} directory ${!directory}."
174+
return 1
175+
fi
176+
done
177+
178+
for fil in inputs_orig model_orig wdt_createDomain_script; do
179+
if [ ! -f "${!fil}" ]; then
180+
echo @@ "Error: Could not find ${fil} file ${!fil}."
181+
return 1
182+
fi
183+
done
184+
185+
cp $model_orig $model_final || return 1
186+
cp $inputs_orig $inputs_final || return 1
187+
188+
local save_dir=`pwd`
189+
cd $WDT_DIR || return 1
190+
191+
echo @@ "Info: WDT createDomain.sh output will be in $out_file and $wdt_log_dir"
192+
193+
# domain_type can be WLS, JRF or RestrictedJRF
194+
$wdt_createDomain_script \
195+
-oracle_home $oracle_home \
196+
-domain_type JRF \
197+
-domain_home $domain_home_dir \
198+
-model_file $model_final \
199+
-variable_file $inputs_final > $out_file 2>&1
200+
201+
local wdt_res=$?
202+
203+
cd $save_dir
204+
205+
if [ $wdt_res -ne 0 ]; then
206+
cat $WDT_DIR/createDomain.sh.out
207+
echo @@ "Info: WDT createDomain.sh output is in $out_file and $wdt_log_dir"
208+
echo @@ "Error: WDT createDomain.sh failed."
209+
return 1
210+
fi
211+
212+
echo @@ "Info: WDT createDomain.sh succeeded."
213+
return 0
214+
}
215+
216+
# Run
217+
218+
setup_wdt_shared_dir || exit 1
219+
220+
install_wdt || exit 1
221+
222+
run_wdt || exit 1

0 commit comments

Comments
 (0)