Skip to content

Commit

Permalink
Merge branch 'patching-irregularities' into 'main'
Browse files Browse the repository at this point in the history
Remove DB19 client installer recommendation from recommended patch list, and include JRF patches in OHS recommendations.

See merge request weblogic-cloud/weblogic-image-tool!492
  • Loading branch information
ddsharpe committed Oct 28, 2024
2 parents 456734c + 17b074e commit e84a049
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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).
* <ol>
* <li>Stack Patch Bundle is a zip of patches, but is not a patch itself.</li>
* <li>DB Client 19c Upgrade (34761383) is an installer, and not a patch.</li>
* </ol>
* @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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ List<AruPatch> 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();
Expand Down Expand Up @@ -273,7 +273,7 @@ List<AruPatch> 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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class DockerfileOptions {

private static final List<String> DEFAULT_OS_PACKAGES = Arrays.asList(
"gzip", "tar", "unzip", "libaio", "libnsl", "jq", "findutils", "diffutils");
private static final List<String> 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";
Expand Down Expand Up @@ -72,6 +73,7 @@ public class DockerfileOptions {
private MiddlewareInstall mwInstallers;
private boolean useOwnerPermsForGroup;
private boolean usingBusybox;
private boolean includeBinaryOsPackages;
private List<String> buildArgs;

// WDT values
Expand Down Expand Up @@ -104,6 +106,7 @@ public DockerfileOptions(String buildId) {
skipMiddlewareInstall = false;
useOwnerPermsForGroup = false;
usingBusybox = false;
includeBinaryOsPackages = false;
buildArgs = new ArrayList<>();

javaHome = DEFAULT_JAVA_HOME;
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -1160,6 +1181,9 @@ public List<String> 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()));
Expand Down

0 comments on commit e84a049

Please sign in to comment.