Skip to content

Commit 745b73c

Browse files
authored
Added modelHome variable for Verrazzano/WKO templates (#241)
1 parent 04d265a commit 745b73c

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed

imagetool/src/main/java/com/oracle/weblogic/imagetool/cachestore/OPatchFile.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public class OPatchFile extends PatchFile {
3636
public static OPatchFile getInstance(String patchId, String userid, String password, CacheStore cache)
3737
throws AruException, XPathExpressionException, IOException {
3838

39+
logger.entering(patchId);
3940
String patchNumber = patchId;
4041
String providedVersion = null;
4142
if (patchId == null) {
@@ -46,13 +47,16 @@ public static OPatchFile getInstance(String patchId, String userid, String passw
4647
int separator = patchId.indexOf(CacheStore.CACHE_KEY_SEPARATOR);
4748
patchNumber = patchId.substring(0, separator);
4849
providedVersion = patchId.substring(separator + 1);
50+
logger.fine("User provided OPatch version {0} {1}", patchNumber, providedVersion);
4951
}
5052

5153
List<AruPatch> patches = AruUtil.rest().getPatches(patchNumber, userid, password);
5254
if (!isOffline(userid, password)) {
5355
// if working online with ARU metadata, filter results based on availability and ARU recommendation
5456
Stream<AruPatch> filteredList = patches.stream().filter(AruPatch::isOpenAccess);
5557
if (providedVersion == null) {
58+
// When the user did not provide a specific version, try to reduce the patch list to one patch.
59+
// There should only be ONE recommended patch/install for OPatch
5660
filteredList = filteredList.filter(AruPatch::isRecommended);
5761
}
5862
patches = filteredList.collect(Collectors.toList());
@@ -65,6 +69,7 @@ public static OPatchFile getInstance(String patchId, String userid, String passw
6569
if (isOffline(userid, password) && providedVersion == null) {
6670
selectedPatch.version(getLatestCachedVersion(cache, patchNumber));
6771
}
72+
logger.exiting(selectedPatch);
6873
return new OPatchFile(selectedPatch, userid, password);
6974
} else {
7075
throw new MultiplePatchVersionsException(patchNumber, patches);

imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/menu/WdtOptions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public void handleResourceTemplates(String imageName) throws IOException {
134134
ResourceTemplateOptions options = new ResourceTemplateOptions()
135135
.domainHome(wdtDomainHome)
136136
.imageName(imageName)
137+
.modelHome(wdtModelHome)
137138
.domainHomeSourceType(domainType);
138139

139140
// resolve parameters in the list of mustache templates returned by gatherFiles()

imagetool/src/main/java/com/oracle/weblogic/imagetool/util/ResourceTemplateOptions.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
public class ResourceTemplateOptions {
1010
private String imageName;
1111
private String domainHome;
12+
private String modelHome;
1213
private DomainHomeSourceType domainHomeSourceType = DomainHomeSourceType.PV;
1314

1415

@@ -17,6 +18,7 @@ public class ResourceTemplateOptions {
1718
*
1819
* @return image tag name
1920
*/
21+
@SuppressWarnings("unused")
2022
public String imageName() {
2123
return imageName;
2224
}
@@ -37,6 +39,7 @@ public ResourceTemplateOptions imageName(String value) {
3739
*
3840
* @return domain home value
3941
*/
42+
@SuppressWarnings("unused")
4043
public String domainHome() {
4144
return domainHome;
4245
}
@@ -60,6 +63,7 @@ public ResourceTemplateOptions domainHome(String value) {
6063
*
6164
* @return domain home source type
6265
*/
66+
@SuppressWarnings("unused")
6367
public String domainHomeSourceType() {
6468
return domainHomeSourceType.toString();
6569
}
@@ -74,4 +78,25 @@ public ResourceTemplateOptions domainHomeSourceType(DomainHomeSourceType value)
7478
domainHomeSourceType = value;
7579
return this;
7680
}
81+
82+
/**
83+
* Return the model home passed in the --wdtModelHome argument or the default if not provided.
84+
*
85+
* @return the location where the models will be written in the image, for --modelOnly
86+
*/
87+
@SuppressWarnings("unused")
88+
public String modelHome() {
89+
return modelHome;
90+
}
91+
92+
/**
93+
* Set the model home.
94+
*
95+
* @param value the model home from the --wdtModelHome argument
96+
* @return builder/this
97+
*/
98+
public ResourceTemplateOptions modelHome(String value) {
99+
modelHome = value;
100+
return this;
101+
}
77102
}

site/create-image.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Usage: imagetool create [OPTIONS]
3030
| `--passwordFile` | Path to a file containing just the Oracle Support password, see `--user`. | |
3131
| `--patches` | Comma separated list of patch IDs. Example: `12345678,87654321` | |
3232
| `--pull` | Always attempt to pull a newer version of base images during the build. | |
33+
| `--resourceTemplates` | One or more files containing placeholders that need to be resolved by the Image Tool. See [Resource Template Files](#resource-template-files). | |
3334
| `--strictPatchOrdering` | Instruct OPatch to apply patches one at a time (uses `apply` instead of `napply`). | |
3435
| `--tag` | (Required) Tag for the final build image. Example: `store/oracle/weblogic:12.2.1.3.0` | |
3536
| `--type` | Installer type. Supported values: `WLS`, `WLSDEV`, `WLSSLIM`, `FMW`, `IDM`, `OSB`, `OUD_WLS`, `SOA_OSB`, `WCP`, `OAM`, `OIG`, `OUD`, `SOA`, `WCC`, `WCS`, `WCP` | `WLS` |
@@ -99,6 +100,19 @@ installation or domain creation steps, use the `final-build-commands` section so
99100
final stage of the image build. Or, if the file needs to change the Oracle Home prior to domain creation, use
100101
the `after-fmw-install` or `before-wdt-command` sections.
101102

103+
#### Resource Template Files
104+
105+
If provided, the file or files provided with `--resourceTemplates` will be overwritten. For known tokens,
106+
the placeholders will be replaced with values according to the following table. **Note:** Placeholders must follow
107+
the Mustache syntax, like `{{imageName}}` or `{{{imageName}}}`.
108+
109+
| Token Name | Value Description |
110+
| --- | --- |
111+
| `domainHome` | The value provided to the Image Tool with `--wdtDomainHome`. |
112+
| `domainHomeSourceType` | `PersistentVolume` (default), `FromModel` if `--wdtModelOnly`, or `Image` if the domain is created in the image with WDT. |
113+
| `imageName` | The value provided to the Image Tool with `--tag`. |
114+
| `modelHome` | The value provided to the Image Tool with `--wdtModelHome`. |
115+
102116
#### Use an argument file
103117

104118
You can save all arguments passed for the Image Tool in a file, then use the file as a parameter.

site/update-image.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Update WebLogic Docker image with selected patches
3939
| `--passwordFile` | Path to a file containing just the Oracle Support password, see `--user`. | |
4040
| `--patches` | Comma separated list of patch IDs. Example: `12345678,87654321` | |
4141
| `--pull` | Always attempt to pull a newer version of base images during the build. | |
42+
| `--resourceTemplates` | One or more files containing placeholders that need to be resolved by the Image Tool. See [Resource Template Files](#resource-template-files). | |
4243
| `--strictPatchOrdering` | Instruct OPatch to apply patches one at a time (uses `apply` instead of `napply`). | |
4344
| `--tag` | (Required) Tag for the final build image. Example: `store/oracle/weblogic:12.2.1.3.0` | |
4445
| `--user` | Oracle support email ID. | |
@@ -109,6 +110,19 @@ The `latestPSU` option will continue to be supported for the CREATE option, but
109110
UPDATE option. Because of the number of patches and their size, using `latestPSU` as an update to an existing image can
110111
increase the size of the image significantly, and is not recommended.
111112

113+
#### Resource Template Files
114+
115+
If provided, the file or files provided with `--resourceTemplates` will be overwritten. For known tokens,
116+
the placeholders will be replaced with values according to the following table. **Note:** Placeholders must follow
117+
the Mustache syntax, like `{{imageName}}` or `{{{imageName}}}`.
118+
119+
| Token Name | Value Description |
120+
| --- | --- |
121+
| `domainHome` | The value provided to the Image Tool with `--wdtDomainHome`. |
122+
| `domainHomeSourceType` | `PersistentVolume` (default), `FromModel` if `--wdtModelOnly`, or `Image` if the domain is created in the image with WDT. |
123+
| `imageName` | The value provided to the Image Tool with `--tag`. |
124+
| `modelHome` | The value provided to the Image Tool with `--wdtModelHome`. |
125+
112126
#### Use an argument file
113127

114128
You can save all arguments passed for the Image Tool in a file, then use the file as a parameter.

0 commit comments

Comments
 (0)