Skip to content

Commit

Permalink
Merge branch 'main' into develop-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
ddsharpe committed Sep 19, 2024
2 parents e2e6210 + 38100af commit 9f8ae6d
Show file tree
Hide file tree
Showing 50 changed files with 804 additions and 379 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish-github-pages.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021, 2023, Oracle and/or its affiliates.
# Copyright (c) 2021, 2024, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
#
# Description
Expand Down Expand Up @@ -36,7 +36,7 @@ jobs:
with:
ref: gh-pages
path: gh-pages
token: ${{ secrets.PUBLISH_SECRET }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Build and publish site
run: |
Expand Down
18 changes: 18 additions & 0 deletions documentation/site/content/userguide/config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: "Configuration"
date: 2024-04-16T08:00:00-05:00
draft: false
weight: 5
---

The default configuration is typically adequate for common use. But, the following environment variables are provided for
non-typical use cases when the default values are insufficient.

### Environment variables

- `WLSIMG_BLDDIR` - During the build process, Image Tool creates a Docker context directory where it will create a Dockerfile and copy necessary files for the container image build. Setting this variable to another directory overrides the default of the user's home directory as the parent folder of the Docker context directory.
- `WLSIMG_BUILDER` - As an alternative to the command-line argument `--builder`, this variable can be used to override the tool to process the Dockerfile (such as`docker` or `podman`). The provided value should be the full path to the executable. For example, `WLSIMG_BUILDER="/usr/bin/docker"`.
- `WLSIMG_CACHEDIR` - When Image Tool downloads patches, those patches are saved in the cache directory. Setting this variable to another directory overrides the default of the `cache` folder in the user's home directory.
- `WLSIMG_OS_PACKAGES` - There are several packages and libraries that are required by the WebLogic Kubernetes Toolkit. The default packages included at build time are `gzip tar unzip libaio libnsl jq findutils diffutils`. The names for those libraries can be different depending on your preferred Linux distribution or OS version. The value that you provide in this environment variable will be used in place of the default package list.


2 changes: 1 addition & 1 deletion imagetool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<artifactId>imagetool-parent</artifactId>
<groupId>com.oracle.weblogic.lifecycle.imagetool</groupId>
<version>1.13.2-SNAPSHOT</version>
<version>1.14.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public enum AruProduct {
WLS("15991", "Oracle WebLogic Server"),
COH("13964", "Oracle Coherence"),
JRF("10120", "Oracle Java Required Files"),
JRF("10120", "Oracle Fusion Middleware"),
FMWPLAT("27638", "FMW Platform"),
OSB("16011", "Oracle Service Bus"),
SOA("12745", "Oracle SOA Suite"),
Expand Down
131 changes: 78 additions & 53 deletions imagetool/src/main/java/com/oracle/weblogic/imagetool/aru/AruUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,19 @@ List<AruPatch> getLatestPsu(AruProduct product, String version, String userId, S
try {
logger.info("IMG-0019", product.description());
String releaseNumber = getReleaseNumber(product, version, userId, password);
if (Utils.isEmptyString(releaseNumber)) {
// ARU does not have a release number for the given product and version, return empty patch list
logger.info(Utils.getMessage("IMG-0082", version, product.description()));
return Collections.emptyList();
}
Document aruRecommendations = retry(
() -> getRecommendedPatchesMetadata(product, releaseNumber, userId, password));
logger.exiting();
return AruPatch.getPatches(aruRecommendations)
.filter(AruPatch::isPsu)
.filter(not(AruPatch::isStackPatchBundle))
.collect(Collectors.toList());
} catch (NoPatchesFoundException | ReleaseNotFoundException ex) {
} catch (NoPatchesFoundException ex) {
logger.exiting();
return Collections.emptyList();
} catch (RetryFailedException | XPathExpressionException e) {
Expand All @@ -154,7 +159,7 @@ List<AruPatch> getLatestPsu(AruProduct product, String version, String userId, S
}

/**
* Get list of recommended patches available for a given product and version.
* Get list of recommended patches available for all the products that are part of the FMW installer type.
*
* @param type FMW installer type
* @param version version number like 12.2.1.3.0
Expand All @@ -165,20 +170,8 @@ public List<AruPatch> getRecommendedPatches(FmwInstallerType type, String versio
String userId, String password) throws AruException {
List<AruPatch> result = new ArrayList<>();
for (AruProduct product : type.products()) {
List<AruPatch> patches = getRecommendedPatches(product, version, userId, password);
// temporary, until OHS stops using same release number and product ID for two different installs
if (type == FmwInstallerType.OHS_DB19) {
if (product == AruProduct.OHS) {
patches = patches.stream().filter(p -> p.description().contains(" DB19C "))
.collect(Collectors.toList());
} else if (product == AruProduct.OAM_WG) {
patches = patches.stream().filter(p -> p.description().contains(" DB19c "))
.collect(Collectors.toList());
} else if (product == AruProduct.OSS) {
patches = patches.stream().filter(p -> p.description().contains(" 19C "))
.collect(Collectors.toList());
}
}
List<AruPatch> patches = getRecommendedPatches(type, product, version, userId, password);

if (!patches.isEmpty()) {
patches.forEach(p -> logger.info("IMG-0068", product.description(), p.patchId(), p.description()));
result.addAll(patches);
Expand All @@ -200,47 +193,71 @@ public List<AruPatch> getRecommendedPatches(FmwInstallerType type, String versio
* @return the recommended patches for the given product and version
* @throws AruException when response from ARU has an error or fails
*/
List<AruPatch> getRecommendedPatches(AruProduct product, String version, String userId, String password)
throws AruException {
List<AruPatch> getRecommendedPatches(FmwInstallerType type, AruProduct product, String version,
String userId, String password) throws AruException {
logger.entering(product, version);
List<AruPatch> patches = Collections.emptyList();
try {
logger.info("IMG-0067", product.description());
String releaseNumber = getReleaseNumber(product, version, userId, password);
Document aruRecommendations = retry(
() -> getRecommendedPatchesMetadata(product, releaseNumber, userId, password));
// TODO: Need an option for the user to request the Coherence additional feature pack.
List<AruPatch> patches = AruPatch.getPatches(aruRecommendations)
.filter(not(AruPatch::isStackPatchBundle)) //remove Stack Patch Bundle
.filter(not(AruPatch::isCoherenceFeaturePack)) //remove COH feature pack
.collect(Collectors.toList());
String psuVersion = getPsuVersion(product.description(), patches);
if (psuVersion != null) {
//repeat the same process to get recommended patches, but use the PSU release instead of the GA release
// All the same patches are in the PSU release, but also the overlay patches (if any)
patches.forEach(p -> logger.fine("Discarding recommended patch {0} {1}", p.patchId(), p.description()));
logger.fine("Recommended patch list contains a PSU, getting recommendations for PSU version {0}",
psuVersion);
// get release number for PSU
String psuReleaseNumber = getReleaseNumber(product, psuVersion, userId, password);
// get recommended patches for PSU release (Overlay patches are only recommended on the PSU release)
Document psuOverrides = retry(
() -> getRecommendedPatchesMetadata(product, psuReleaseNumber, userId, password));

patches = AruPatch.getPatches(psuOverrides)
.filter(not(AruPatch::isStackPatchBundle)) // remove the Stack Patch Bundle patch, if returned
.filter(not(AruPatch::isCoherenceFeaturePack)) // remove the Coherence feature pack, if returned
.collect(Collectors.toList());
if (Utils.isEmptyString(releaseNumber)) {
// ARU does not have a release number for the given product and version, return an empty patch list
logger.info(Utils.getMessage("IMG-0082", version, product.description()));
} else {
// Get a list of patches applicable to the given product and release number
patches = getReleaseRecommendations(product, releaseNumber, userId, password);
logger.fine("Search for {0} recommended patches returned {1}", product, patches.size());
if (type == FmwInstallerType.OHS_DB19) {
// Workaround for OHS where the DB19 patches and the DB12 patches have the same product/release ID
patches = filterDb19Patches(patches, product);
}

String psuVersion = getPsuVersion(product.description(), patches);
if (psuVersion != null) {
// Check to see if there is a release with the PSU version that contains overlay patches.
logger.fine("Recommended patch list contains a PSU, getting recommendations for PSU version {0}",
psuVersion);
// Get the release number for the PSU version number
String psuReleaseNumber = getReleaseNumber(product, psuVersion, userId, password);
// If there is a release for the specific PSU, check it for overlay patches
if (!Utils.isEmptyString(psuReleaseNumber)) {
// Get recommended patches for PSU release (includes PSU overlay patches)
List<AruPatch> overlays =
getReleaseRecommendations(product, psuReleaseNumber, userId, password);
logger.fine("Search for PSU {0} overlay patches returned {1}", psuVersion, overlays.size());
patches.addAll(overlays);
} else {
// ARU does not have a release number for the PSU version found (no overlays needed)
logger.fine("PSU release was not found for {0} : {1}", product, psuVersion);
}
}
}
logger.exiting(patches);
return patches;
} catch (ReleaseNotFoundException nf) {
return Collections.emptyList();
} catch (NoPatchesFoundException npf) {
logger.info("IMG-0069", product.description(), version);
return Collections.emptyList();
} catch (RetryFailedException | XPathExpressionException e) {
throw new AruException(Utils.getMessage("IMG-0070", product.description(), version), e);
}
logger.exiting(patches);
return patches;
}

/**
* This is a temporary workaround to select DB19 patches from a recommended list of patches.
* Currently, OHS is using the same release number and product ID for two different installs (DB19 and DB12).
* @param patches patches list to filter
* @param product AruProduct that the supplied patches are for
*/
private List<AruPatch> filterDb19Patches(List<AruPatch> patches, AruProduct product) {
List<AruPatch> result = patches;
// temporary, until OHS stops using same release number and product ID for two different installs
if (product == AruProduct.OHS) {
result = patches.stream().filter(p -> p.description().contains(" DB19C ")).collect(Collectors.toList());
} else if (product == AruProduct.OAM_WG) {
result = patches.stream().filter(p -> p.description().contains(" DB19c ")).collect(Collectors.toList());
} else if (product == AruProduct.OSS) {
result = patches.stream().filter(p -> p.description().contains(" 19C ")).collect(Collectors.toList());
}
return result;
}

private String getPsuVersion(String productName, Collection<AruPatch> patches) {
Expand All @@ -256,6 +273,20 @@ private String getPsuVersion(String productName, Collection<AruPatch> patches) {
return null;
}

List<AruPatch> getReleaseRecommendations(AruProduct product, String releaseNumber, String userId, String password)
throws AruException, XPathExpressionException, RetryFailedException {

Document patchesDocument = retry(
() -> getRecommendedPatchesMetadata(product, releaseNumber, userId, password));

return AruPatch.getPatches(patchesDocument)
.filter(not(AruPatch::isStackPatchBundle)) // 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))
.collect(Collectors.toList());
}

static class PatchLists {
List<InstalledPatch> installedPatches;
List<AruPatch> candidatePatches;
Expand Down Expand Up @@ -358,7 +389,6 @@ Document getRecommendedPatchesMetadata(AruProduct product, String releaseNumber,
* @param password OTN credential password
* @return release number for the product and version provided
* @throws AruException if the call to ARU fails, or the response from ARU had an error
* @throws ReleaseNotFoundException if the specified version for the requested product was not found
*/
private String getReleaseNumber(AruProduct product, String version, String userId, String password)
throws AruException {
Expand All @@ -375,11 +405,6 @@ private String getReleaseNumber(AruProduct product, String version, String userI
} catch (XPathExpressionException xpe) {
throw new AruException("Could not extract release number with XPath", xpe);
}
if (Utils.isEmptyString(result)) {
String msg = Utils.getMessage("IMG-0082", version, product.description());
logger.info(msg);
throw new ReleaseNotFoundException(msg);
}
logger.exiting(result);
return result;
}
Expand Down

This file was deleted.

Loading

0 comments on commit 9f8ae6d

Please sign in to comment.