Skip to content

Commit 00c4906

Browse files
committed
Merge branch 'fix-getwlsversion-and-matchmodelunzip' into 'main'
Fix how getWebLogicVersion is implemented and keep track of bin/lib contents... See merge request weblogic-cloud/weblogic-kubernetes-operator!4682 (cherry picked from commit 0bcc038) 3e2fdf8 Fix how getWebLogicVersion is implemented and keep track of bin/lib contents...
1 parent aa9db1b commit 00c4906

File tree

4 files changed

+48
-21
lines changed

4 files changed

+48
-21
lines changed

operator/src/main/resources/scripts/introspectDomain.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2018, 2023, Oracle and/or its affiliates.
1+
# Copyright (c) 2018, 2024, Oracle and/or its affiliates.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33
#
44
# ------------
@@ -165,6 +165,9 @@ def open(self):
165165
# Check environment variable that skip leasing validation
166166
self.SKIP_LEASING_VALIDATIONS = self.getEnvOrDef('SKIP_LEASING_VALIDATIONS', "False")
167167

168+
# Extracted list for bin lib during domain creation
169+
self.DOMAIN_LIB_BIN_LIST = self.INTROSPECT_HOME + "/binliblist"
170+
168171
# maintain a list of errors that we include in topology.yaml on completion, if any
169172

170173
self.errors = []
@@ -1969,6 +1972,8 @@ def introspect(self):
19691972
trace("cfgmap write domain wdt version")
19701973
if os.path.exists('/tmp/domain_wdt_version'):
19711974
MII_IntrospectCMFileGenerator(self.env, self.env.MII_DOMAIN_WDT_VERSION, '/tmp/domain_wdt_version').generate()
1975+
if os.path.exists('/tmp/binlibdir.txt'):
1976+
MII_IntrospectCMFileGenerator(self.env, self.env.DOMAIN_LIB_BIN_LIST, '/tmp/binlibdir.txt').generate()
19721977

19731978
if self.isFromModelAndJRFDomain() or self.isInitializeDomainJRFOnPV():
19741979
trace("cfgmap write JRF wallet")

operator/src/main/resources/scripts/modelInImage.sh

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# Copyright (c) 2018, 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2018, 2024, Oracle and/or its affiliates.
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
#
55
# This script contains the all the function of model in image
@@ -28,7 +28,7 @@ LOCAL_PRIM_DOMAIN_TAR="/tmp/prim_domain.tar"
2828
NEW_MERGED_MODEL="/tmp/new_merged_model.json"
2929
WDT_CONFIGMAP_ROOT="/weblogic-operator/wdt-config-map"
3030
RUNTIME_ENCRYPTION_SECRET_PASSWORD="/weblogic-operator/model-runtime-secret/password"
31-
31+
DOMAIN_BIN_LIB_LIST="/weblogic-operator/introspector/binliblist"
3232
# we export the opss password file location because it's also used by introspectDomain.py
3333
export OPSS_KEY_PASSPHRASE="/weblogic-operator/opss-walletkey-secret/walletPassword"
3434
OPSS_KEY_B64EWALLET="/weblogic-operator/opss-walletfile-secret/walletFile"
@@ -1065,6 +1065,8 @@ wdtUpdateModelDomain() {
10651065
#
10661066
local MII_PASSPHRASE=$(cat ${RUNTIME_ENCRYPTION_SECRET_PASSWORD})
10671067

1068+
captureBinLibAdded
1069+
10681070
gzip ${DOMAIN_HOME}/wlsdeploy/domain_model.json || exitOrLoop
10691071
base64 ${DOMAIN_HOME}/wlsdeploy/domain_model.json.gz > ${DOMAIN_HOME}/wlsdeploy/domain_model.json.b64 || exitOrLoop
10701072
encrypt_decrypt_model "encrypt" ${DOMAIN_HOME}/wlsdeploy/domain_model.json.b64 ${MII_PASSPHRASE} \
@@ -1077,6 +1079,12 @@ wdtUpdateModelDomain() {
10771079
trace "Exiting wdtUpdateModelDomain"
10781080
}
10791081

1082+
captureBinLibAdded() {
1083+
local BINLIBDIR_NAME="/tmp/binlibdir.txt"
1084+
find $DOMAIN_HOME/bin -maxdepth 1 -type f | sed "s|$DOMAIN_HOME/bin|wlsdeploy/domainBin|g" > $BINLIBDIR_NAME
1085+
find $DOMAIN_HOME/lib -maxdepth 1 -type f | sed "s|$DOMAIN_HOME/bin|wlsdeploy/domainLibraries|g" >> $BINLIBDIR_NAME
1086+
}
1087+
10801088
wdtHandleOnlineUpdate() {
10811089

10821090
trace "Entering wdtHandleOnlineUpdate"
@@ -1305,7 +1313,11 @@ restoreAppAndLibs() {
13051313

13061314
# expand the archive domain libraries to the domain lib, 11 is caution when zip entry doesn't exists
13071315
cd ${DOMAIN_HOME}/lib || exitOrLoop
1308-
unzip -jo ${IMG_ARCHIVES_ROOTDIR}/${file} wlsdeploy/domainLibraries/*
1316+
if [ -f $DOMAIN_BIN_LIB_LIST ] ; then
1317+
unzip -jo ${IMG_ARCHIVES_ROOTDIR}/${file} $(awk '{print $0}' <<< $(grep "wlsdeploy/domainLibraries" $DOMAIN_BIN_LIB_LIST))
1318+
else
1319+
unzip -jo ${IMG_ARCHIVES_ROOTDIR}/${file} wlsdeploy/domainLibraries/*
1320+
fi
13091321
ret=$?
13101322
if [ $ret -ne 0 ] && [ $ret -ne 11 ] ; then
13111323
trace SEVERE "Domain Source Type is FromModel, error in extracting domainLibraries " \
@@ -1316,7 +1328,13 @@ restoreAppAndLibs() {
13161328
# expand the domain bin, in update case user may only update a file in the domainBin archive, 11 is caution when
13171329
# zip entry doesn't exists
13181330
cd ${DOMAIN_HOME}/bin || exitOrLoop
1319-
unzip -jo ${IMG_ARCHIVES_ROOTDIR}/${file} wlsdeploy/domainBin/*
1331+
if [ -f $DOMAIN_BIN_LIB_LIST ] ; then
1332+
unzip -jo ${IMG_ARCHIVES_ROOTDIR}/${file} $(awk '{print $0}' <<< $(grep "wlsdeploy/domainBin" $DOMAIN_BIN_LIB_LIST))
1333+
else
1334+
unzip -jo ${IMG_ARCHIVES_ROOTDIR}/${file} wlsdeploy/domainBin/*
1335+
fi
1336+
1337+
#unzip -jo ${IMG_ARCHIVES_ROOTDIR}/${file} wlsdeploy/domainBin/*
13201338
ret=$?
13211339
if [ $ret -ne 0 ] && [ $ret -ne 11 ] ; then
13221340
trace SEVERE "Domain Source Type is FromModel, error in extracting domainBin " \

operator/src/main/resources/scripts/utils.sh

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Copyright (c) 2017, 2023, Oracle and/or its affiliates.
1+
#!/bin/sh
2+
# Copyright (c) 2017, 2024, Oracle and/or its affiliates.
23
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
34

45
set -o pipefail
@@ -494,21 +495,16 @@ hasWebLogicPatches()
494495
}
495496

496497
# getWebLogicVersion
497-
# parse wl version from install inventory
498498
# - if we can't get a version number then we return
499499
# a high dummy version number that's sufficient
500500
# to pass version checks "9999.9999.9999.9999"
501-
# - we parse the install inventory as this is far faster than
502-
# using opatch or weblogic.version
503501
getWebLogicVersion()
504502
{
505-
local reg_file=$ORACLE_HOME/inventory/registry.xml
503+
$ORACLE_HOME/oracle_common/common/bin/wlst.sh /weblogic-operator/scripts/wlversion.py > /dev/null 2>&1
506504

507-
[ ! -f $reg_file ] && echo "9999.9999.9999.9999" && return
508-
509-
# The following grep captures both "WebLogic Server" and "WebLogic Server for FMW"
510-
local wlver="`grep 'name="WebLogic Server.*version=' $reg_file \
511-
| sed 's/.*version="\([0-9.]*\)".*/\1/g'`"
505+
if [ $? -eq 0 ] ; then
506+
wlver=$(cat /tmp/wlsversion.txt)
507+
fi
512508

513509
echo ${wlver:-"9999.9999.9999.9999"}
514510
}
@@ -538,9 +534,9 @@ getMajorVersion()
538534
# checkWebLogicVersion
539535
# check if the WL version is supported by the Operator
540536
# - skip check if SKIP_WL_VERSION_CHECK = "true"
541-
# - log an error if WL version < 12.2.1.3
542-
# - log an error if WL version == 12.2.1.3 && patch 29135930 is missing
543-
# - you can override the required 12.2.1.3 patches by exporting
537+
# - log an error if WL version < 12.2.1.3.0
538+
# - log an error if WL version == 12.2.1.3.0 && patch 29135930 is missing
539+
# - you can override the required 12.2.1.3.0 patches by exporting
544540
# global WL12213REQUIREDPATCHES to an empty string or to other
545541
# patch number(s)
546542
# - return 1 if logged an error
@@ -549,11 +545,11 @@ checkWebLogicVersion()
549545
{
550546
[ "$SKIP_WL_VERSION_CHECK" = "true" ] && return 0
551547
local cur_wl_ver="`getWebLogicVersion`"
552-
local exp_wl_ver="12.2.1.3"
548+
local exp_wl_ver="12.2.1.3.0"
553549
local exp_wl_12213_patches="${WL12213REQUIREDPATCHES:-"29135930"}"
554-
if versionEQ "$cur_wl_ver" "12.2.1.3" ; then
550+
if versionEQ "$cur_wl_ver" "12.2.1.3.0" ; then
555551
if ! hasWebLogicPatches $exp_wl_12213_patches ; then
556-
trace SEVERE "The Operator requires that WebLogic version '12.2.1.3' have patch '$exp_wl_12213_patches'. To bypass this check, set env var SKIP_WL_VERSION_CHECK to 'true'."
552+
trace SEVERE "The Operator requires that WebLogic version '12.2.1.3.0' have patch '$exp_wl_12213_patches'. To bypass this check, set env var SKIP_WL_VERSION_CHECK to 'true'."
557553
return 1
558554
fi
559555
fi
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) 2024, Oracle and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
4+
import weblogic.version as version_helper
5+
fh = open('/tmp/wlsversion.txt', 'w')
6+
fh.write(version_helper.getReleaseBuildVersion())
7+
fh.close()
8+
exit()

0 commit comments

Comments
 (0)