From 17b074e991ea670b4942dba7686a9a67a31d17b2 Mon Sep 17 00:00:00 2001 From: "derek.sharpe" Date: Mon, 28 Oct 2024 15:57:13 +0000 Subject: [PATCH] Remove DB19 client installer recommendation from recommended patch list, and include JRF patches in OHS recommendations. --- .../weblogic/imagetool/aru/AruPatch.java | 16 +++++++++++++ .../weblogic/imagetool/aru/AruUtil.java | 4 ++-- .../cli/menu/CommonCreateOptions.java | 2 ++ .../imagetool/installer/FmwInstallerType.java | 2 +- .../imagetool/util/DockerfileOptions.java | 24 +++++++++++++++++++ 5 files changed, 45 insertions(+), 3 deletions(-) diff --git a/imagetool/src/main/java/com/oracle/weblogic/imagetool/aru/AruPatch.java b/imagetool/src/main/java/com/oracle/weblogic/imagetool/aru/AruPatch.java index 98e8f4aa..c03bc0b3 100644 --- a/imagetool/src/main/java/com/oracle/weblogic/imagetool/aru/AruPatch.java +++ b/imagetool/src/main/java/com/oracle/weblogic/imagetool/aru/AruPatch.java @@ -166,6 +166,22 @@ public boolean isStackPatchBundle() { return description != null && description.contains("STACK PATCH BUNDLE"); } + /** + * Returns true if this patch is known irregular patch (not an actual patch). + *
    + *
  1. Stack Patch Bundle is a zip of patches, but is not a patch itself.
  2. + *
  3. DB Client 19c Upgrade (34761383) is an installer, and not a patch.
  4. + *
+ * @return true if this patch is a StackPatchBundle or known installer, false otherwise. + */ + public boolean isIrregularPatch() { + boolean result = "34761383".equals(patchId) || isStackPatchBundle(); + if (result) { + logger.fine("Detected irregular patch {0}: {1}", patchId, description); + } + return result; + } + public boolean isCoherenceFeaturePack() { return description != null && description.contains("Coherence 14.1.1 Feature Pack"); } diff --git a/imagetool/src/main/java/com/oracle/weblogic/imagetool/aru/AruUtil.java b/imagetool/src/main/java/com/oracle/weblogic/imagetool/aru/AruUtil.java index 64c8f26a..fe4f70a2 100644 --- a/imagetool/src/main/java/com/oracle/weblogic/imagetool/aru/AruUtil.java +++ b/imagetool/src/main/java/com/oracle/weblogic/imagetool/aru/AruUtil.java @@ -155,7 +155,7 @@ List getLatestPsu(AruProduct product, String version, Architecture arc return AruPatch.getPatches(aruRecommendations) .filter(p -> p.isApplicableToTarget(architecture.getAruPlatform())) .filter(AruPatch::isPsu) - .filter(not(AruPatch::isStackPatchBundle)) + .filter(not(AruPatch::isIrregularPatch)) .collect(Collectors.toList()); } catch (NoPatchesFoundException ex) { logger.exiting(); @@ -273,7 +273,7 @@ List getReleaseRecommendations(AruProduct product, String releaseNumbe return AruPatch.getPatches(patchesDocument) .filter(p -> p.isApplicableToTarget(architecture.getAruPlatform())) - .filter(not(AruPatch::isStackPatchBundle)) // remove the Stack Patch Bundle patch, if returned + .filter(not(AruPatch::isIrregularPatch)) // remove the Stack Patch Bundle patch, if returned // TODO: Need an option for the user to request the Coherence additional feature pack. .filter(not(AruPatch::isCoherenceFeaturePack)) // remove the Coherence feature pack, if returned .filter(p -> p.release().equals(releaseNumber)) diff --git a/imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/menu/CommonCreateOptions.java b/imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/menu/CommonCreateOptions.java index e748e714..d22d26d2 100644 --- a/imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/menu/CommonCreateOptions.java +++ b/imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/menu/CommonCreateOptions.java @@ -11,6 +11,7 @@ import com.oracle.weblogic.imagetool.api.model.CachedFile; import com.oracle.weblogic.imagetool.aru.AruException; +import com.oracle.weblogic.imagetool.installer.FmwInstallerType; import com.oracle.weblogic.imagetool.installer.InstallerType; import com.oracle.weblogic.imagetool.installer.MiddlewareInstall; import com.oracle.weblogic.imagetool.logging.LoggingFacade; @@ -44,6 +45,7 @@ void prepareNewImage() throws IOException, InterruptedException, XPathExpression installerResponseFiles, getTargetArchitecture()); install.copyFiles(cache(), buildDir()); dockerfileOptions.setMiddlewareInstall(install); + dockerfileOptions.includeBinaryOsPackages(getInstallerType().equals(FmwInstallerType.OHS)); } else { dockerfileOptions.setWdtBase("os_update"); } diff --git a/imagetool/src/main/java/com/oracle/weblogic/imagetool/installer/FmwInstallerType.java b/imagetool/src/main/java/com/oracle/weblogic/imagetool/installer/FmwInstallerType.java index aa328ca1..e83da945 100644 --- a/imagetool/src/main/java/com/oracle/weblogic/imagetool/installer/FmwInstallerType.java +++ b/imagetool/src/main/java/com/oracle/weblogic/imagetool/installer/FmwInstallerType.java @@ -81,7 +81,7 @@ public enum FmwInstallerType { WCS(Utils.toSet(FMW.products, AruProduct.WCS), InstallerType.FMW, InstallerType.WCS), OHS(Utils.toSet(AruProduct.OHS, AruProduct.OAM_WG, AruProduct.WLS, AruProduct.JDBC, AruProduct.FMWPLAT, - AruProduct.OSS, AruProduct.FIT, AruProduct.FMW_GLCM), + AruProduct.OSS, AruProduct.FIT, AruProduct.JRF, AruProduct.FMW_GLCM), InstallerType.OHS, InstallerType.DB19), ODI(Collections.singleton(AruProduct.ODI), InstallerType.ODI) diff --git a/imagetool/src/main/java/com/oracle/weblogic/imagetool/util/DockerfileOptions.java b/imagetool/src/main/java/com/oracle/weblogic/imagetool/util/DockerfileOptions.java index 30b8c2a3..3cb2955b 100644 --- a/imagetool/src/main/java/com/oracle/weblogic/imagetool/util/DockerfileOptions.java +++ b/imagetool/src/main/java/com/oracle/weblogic/imagetool/util/DockerfileOptions.java @@ -39,6 +39,7 @@ public class DockerfileOptions { private static final List DEFAULT_OS_PACKAGES = Arrays.asList( "gzip", "tar", "unzip", "libaio", "libnsl", "jq", "findutils", "diffutils"); + private static final List BINARY_OS_PACKAGES = Arrays.asList("binutils", "make", "glibc-devel"); private static final String WLSIMG_OS_PACKAGES = System.getenv("WLSIMG_OS_PACKAGES"); private static final String DEFAULT_ORAINV_DIR = "/u01/oracle/oraInventory"; @@ -72,6 +73,7 @@ public class DockerfileOptions { private MiddlewareInstall mwInstallers; private boolean useOwnerPermsForGroup; private boolean usingBusybox; + private boolean includeBinaryOsPackages; private List buildArgs; // WDT values @@ -104,6 +106,7 @@ public DockerfileOptions(String buildId) { skipMiddlewareInstall = false; useOwnerPermsForGroup = false; usingBusybox = false; + includeBinaryOsPackages = false; buildArgs = new ArrayList<>(); javaHome = DEFAULT_JAVA_HOME; @@ -1109,6 +1112,24 @@ public boolean useOwnerPermsForGroup() { return useOwnerPermsForGroup; } + /** + * Include OS packages for binary patching such as make for OPatch. + * @param value true if additional OS patches for binary patching should be added to the image. + * @return this + */ + public DockerfileOptions includeBinaryOsPackages(boolean value) { + includeBinaryOsPackages = value; + return this; + } + + /** + * Returns true if additional OS patches for binary patching should be added to the image. + * @return true if additional OS patches for binary patching should be added to the image, false otherwise. + */ + public boolean includeBinaryOsPackages() { + return includeBinaryOsPackages; + } + /** * Returns true if BusyBox options should be used in the Dockerfile. * @@ -1160,6 +1181,9 @@ public List osPackages() { if (Utils.isEmptyString(WLSIMG_OS_PACKAGES)) { // If the user did not provide a list of OS packages, use the default list result.addAll(DEFAULT_OS_PACKAGES); + if (includeBinaryOsPackages()) { + result.addAll(BINARY_OS_PACKAGES); + } } else { // When provided in the environment variable, use the list of OS packages provided by the user. result.addAll(Stream.of(WLSIMG_OS_PACKAGES.split(" ")).collect(Collectors.toList()));