Skip to content

Commit 27824b4

Browse files
gosurya-oraclejshum2479
authored andcommitted
added shade plugin to build uber jar
Former-commit-id: eb6abbfd495a9d1cd18db135bfbc5a1442757635
1 parent 2f191c2 commit 27824b4

File tree

7 files changed

+120
-102
lines changed

7 files changed

+120
-102
lines changed

pom.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,34 @@
3030
<version>3.8.0</version>
3131
</dependency>
3232
</dependencies>
33+
34+
<build>
35+
<plugins>
36+
<plugin>
37+
<groupId>org.apache.maven.plugins</groupId>
38+
<artifactId>maven-shade-plugin</artifactId>
39+
<version>3.2.1</version>
40+
<executions>
41+
<execution>
42+
<phase>package</phase>
43+
<goals>
44+
<goal>shade</goal>
45+
</goals>
46+
<configuration>
47+
<!--<artifactSet>-->
48+
<!--<excludes>-->
49+
<!--<exclude>classworlds:classworlds</exclude>-->
50+
<!--<exclude>junit:junit</exclude>-->
51+
<!--<exclude>jmock:*</exclude>-->
52+
<!--<exclude>*:xml-apis</exclude>-->
53+
<!--<exclude>org.apache.maven:lib:tests</exclude>-->
54+
<!--<exclude>log4j:log4j:jar:</exclude>-->
55+
<!--</excludes>-->
56+
<!--</artifactSet>-->
57+
</configuration>
58+
</execution>
59+
</executions>
60+
</plugin>
61+
</plugins>
62+
</build>
3363
</project>

src/main/java/com/oracle/weblogicx/imagebuilder/builder/cli/BuilderCLIDriver.java

Lines changed: 6 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public CommandResponse call() throws Exception {
5656
System.out.println("patches = \"" + patches + "\"");
5757
System.out.println("fromImage = \"" + fromImage + "\"");
5858
System.out.println("userId = \"" + userId + "\"");
59-
System.out.println("password = \"" + password + "\"");
6059
System.out.println("publish = \"" + isPublish + "\"");
6160

6261
FileHandler fileHandler = null;
@@ -121,7 +120,7 @@ public CommandResponse call() throws Exception {
121120

122121
if (!targetFile.exists() || !META_RESOLVER.hasMatchingKeyValue(propKey, targetFilePath)) {
123122
if (useCache != always) {
124-
//System.out.println("1. Downloading from " + propVal + " to " + targetFilePath);
123+
System.out.println("1. Downloading from " + propVal + " to " + targetFilePath);
125124
logger.info("1. Downloading from " + propVal + " to " + targetFilePath);
126125
HttpUtil.downloadFile(propVal, targetFilePath, userId, password);
127126
META_RESOLVER.addToCache(propKey, targetFilePath);
@@ -145,7 +144,7 @@ public CommandResponse call() throws Exception {
145144
if ("12.2.1.3.0".equals(installerVersion) ) {
146145
if (!opatchFile.exists() || !META_RESOLVER.hasMatchingKeyValue(opatchKey, opatch_1394_path)) {
147146
if (useCache != always) {
148-
//System.out.println("3. Downloading from " + OPATCH_1394_URL + " to " + opatch_1394_path);
147+
System.out.println("3. Downloading from " + OPATCH_1394_URL + " to " + opatch_1394_path);
149148
logger.info("3. Downloading from " + OPATCH_1394_URL + " to " + opatch_1394_path);
150149
HttpUtil.downloadFile(OPATCH_1394_URL, opatch_1394_path, userId, password);
151150
META_RESOLVER.addToCache(opatchKey, opatch_1394_path);
@@ -262,8 +261,6 @@ public CommandResponse call() throws Exception {
262261
}
263262

264263
private List<String> getInitialBuildCmd() {
265-
// List<String> cmdBuilder = new ArrayList<>(Arrays.asList("docker", "build",
266-
// "--squash", "--force-rm", "--no-cache", "--network=host"));
267264
List<String> cmdBuilder = Stream.of("docker", "build",
268265
"--squash", "--force-rm", "--no-cache", "--network=host").collect(Collectors.toList());
269266

@@ -390,6 +387,7 @@ private void setSystemProxy(String proxyUrl, String protocolToSet) {
390387
names = { "--password" },
391388
paramLabel = "<password associated with support user id>",
392389
required = true,
390+
interactive = true,
393391
description = "Password for support userId"
394392
)
395393
private String password;
@@ -413,9 +411,9 @@ private void setSystemProxy(String proxyUrl, String protocolToSet) {
413411
private boolean isPublish = false;
414412

415413
@Option(
416-
hidden = true,
417-
names = { "--httpProxyUrl" },
418-
description = "proxy for http protocol. Ex: http://myproxy:80 or http://user:passwd@myproxy:8080"
414+
hidden = true,
415+
names = { "--httpProxyUrl" },
416+
description = "proxy for http protocol. Ex: http://myproxy:80 or http://user:passwd@myproxy:8080"
419417
)
420418
private String httpProxyUrl;
421419

@@ -445,94 +443,6 @@ private void setSystemProxy(String proxyUrl, String protocolToSet) {
445443
)
446444
private boolean isCLIMode;
447445

448-
public InstallerType getInstallerType() {
449-
return installerType;
450-
}
451-
452-
public void setInstallerType(InstallerType installerType) {
453-
this.installerType = installerType;
454-
}
455-
456-
public String getInstallerVersion() {
457-
return installerVersion;
458-
}
459-
460-
public void setInstallerVersion(String installerVersion) {
461-
this.installerVersion = installerVersion;
462-
}
463-
464-
public String getJdkVersion() {
465-
return jdkVersion;
466-
}
467-
468-
public void setJdkVersion(String jdkVersion) {
469-
this.jdkVersion = jdkVersion;
470-
}
471-
472-
public boolean isLatestPSU() {
473-
return latestPSU;
474-
}
475-
476-
public void setLatestPSU(boolean latestPSU) {
477-
this.latestPSU = latestPSU;
478-
}
479-
480-
public List<String> getPatches() {
481-
return patches;
482-
}
483-
484-
public void setPatches(List<String> patches) {
485-
this.patches = patches;
486-
}
487-
488-
public String getFromImage() {
489-
return fromImage;
490-
}
491-
492-
public void setFromImage(String fromImage) {
493-
this.fromImage = fromImage;
494-
}
495-
496-
public String getImageTag() {
497-
return imageTag;
498-
}
499-
500-
public void setImageTag(String imageTag) {
501-
this.imageTag = imageTag;
502-
}
503-
504-
public String getUserId() {
505-
return userId;
506-
}
507-
508-
public void setUserId(String userId) {
509-
this.userId = userId;
510-
}
511-
512-
public String getPassword() {
513-
return password;
514-
}
515-
516-
public void setPassword(String password) {
517-
this.password = password;
518-
}
519-
520-
public CachePolicy getUseCache() {
521-
return useCache;
522-
}
523-
524-
public void setUseCache(CachePolicy useCache) {
525-
this.useCache = useCache;
526-
}
527-
528-
public boolean isPublish() {
529-
return isPublish;
530-
}
531-
532-
public void setPublish(boolean publish) {
533-
isPublish = publish;
534-
}
535-
536446
static class WLSVersionValues extends ArrayList<String> {
537447
WLSVersionValues() {
538448
super(Arrays.asList("12.2.1.3.0", "12.2.1.2.0"));

src/main/java/com/oracle/weblogicx/imagebuilder/builder/cli/CacheCLI.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ public class CacheCLI implements Runnable {
3535
)
3636
private Path cacheDirPath = null;
3737

38+
@Option(
39+
names = { "--cli" },
40+
description = "CLI Mode",
41+
hidden = true
42+
)
43+
private boolean isCLIMode;
44+
3845
@Override
3946
public void run() {
4047
if (listCachePath) {

src/main/java/com/oracle/weblogicx/imagebuilder/builder/util/ARUConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
public class ARUConstants {
66

7+
public static final String OPATCH_KEY = "opatch_1394";
78
public static final String OPATCH_1394_URL="https://updates.oracle.com/Orion/Services/download/" +
89
"p28186730_139400_Generic.zip?aru=22310944&patch_file=p28186730_139400_Generic.zip";
910
static final String REL_URL = "https://updates.oracle.com/Orion/Services/metadata?table=aru_releases";

src/main/java/com/oracle/weblogicx/imagebuilder/builder/util/ARUUtil.java

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,25 @@ public static List<String> getPatchesFor(String category, String version, List<S
134134
return results;
135135
}
136136

137-
/**
137+
/** Validate patches conflicts by passing a list of patches
138138
*
139139
* @param patches A list of patches number
140140
* @param category wls or fmw
141141
* @param version version of the prduct
142142
* @param userId userid for support account
143143
* @param password password for support account
144+
* @return validationResult validation result object
144145
* @throws IOException when failed to access the aru api
145146
*/
146147

147-
public static boolean validatePatches(List<String> patches, String category, String version, String userId, String
148+
public static ValidationResult validatePatches(List<String> patches, String category, String version, String userId, String
148149
password) throws IOException {
149150

151+
152+
ValidationResult validationResult = new ValidationResult();
153+
validationResult.setSuccess(true);
154+
validationResult.setResults(null);
155+
150156
StringBuffer payload = new StringBuffer
151157
("<conflict_check_request><platform>2000</platform><target_patch_list/>");
152158
String releaseNumber = getReleaseNumber(category, version, userId, password);
@@ -161,7 +167,7 @@ public static boolean validatePatches(List<String> patches, String category, Str
161167

162168
try {
163169
NodeList conflictSets = XPathUtil.applyXPathReturnNodeList(result, "/conflict_sets");
164-
if (conflictSets.getLength() == 0) {
170+
if (conflictSets.getLength() > 0) {
165171

166172

167173
try {
@@ -189,7 +195,7 @@ public static boolean validatePatches(List<String> patches, String category, Str
189195
System.out.println("");
190196
XPathUtil.prettyPrint(doc);
191197

192-
return true;
198+
validationResult.setResults(doc);
193199

194200

195201
} catch (XPathExpressionException | ParserConfigurationException xpe) {
@@ -202,9 +208,36 @@ public static boolean validatePatches(List<String> patches, String category, Str
202208
throw new IOException(xpe);
203209

204210
}
205-
return false;
211+
return validationResult;
212+
}
213+
214+
/**
215+
* Return the patch detail
216+
* @param category wls or fmw
217+
* @param version version of the product
218+
* @param bugNumber bug number
219+
* @param userId user id for support
220+
* @param password password for support
221+
* @return dom document detail about the patch
222+
* @throws IOException when something goes wrong
223+
*/
224+
public static Document getPatchDetail(String category, String version, String bugNumber, String userId, String
225+
password)
226+
throws
227+
IOException {
228+
229+
String releaseNumber = getReleaseNumber(category, version, userId, password );
230+
String url;
231+
if ("wls".equalsIgnoreCase(category))
232+
url = String.format(PATCH_SEARCH_URL, WLS_PROD_ID, bugNumber, releaseNumber);
233+
else
234+
url = String.format(PATCH_SEARCH_URL, FMW_PROD_ID, bugNumber, releaseNumber);
235+
236+
return HttpUtil.getXMLContent(url, userId, password);
237+
206238
}
207239

240+
208241
private static Document getAllReleases(String category, String userId, String password) throws IOException {
209242

210243

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.oracle.weblogicx.imagebuilder.builder.util;
2+
3+
import org.w3c.dom.Document;
4+
5+
/**
6+
* ValidaitonResult of patch conflicts check
7+
*/
8+
9+
public class ValidationResult {
10+
private boolean success;
11+
private Document results;
12+
13+
/**
14+
*
15+
* @return true if no conflicts ; false if there is conflicts
16+
*
17+
*/
18+
public boolean isSuccess() {
19+
return success;
20+
}
21+
22+
public void setSuccess(boolean success) {
23+
this.success = success;
24+
}
25+
26+
/**
27+
*
28+
* @return dom document detailing about the conflicts
29+
*/
30+
public Document getResults() {
31+
return results;
32+
}
33+
34+
public void setResults(Document results) {
35+
this.results = results;
36+
}
37+
}

src/main/resources/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ RUN curl -s -o $TMPDIR/maven.tar.gz \
9191
#RUN /u01/app/tools/weblogic-deploy/bin/createDomain.sh ...
9292

9393
# Cleanup
94-
RUN $MW_HOME/OPatch/opatch util cleanup -silent \
94+
RUN $MW_HOME/OPatch/opatch util cleanup -invPtrLoc $INV_LOC/$ORAINST -silent \
9595
&& rm -fr $TMPDIR
9696

9797
ENTRYPOINT /bin/bash

0 commit comments

Comments
 (0)