Skip to content

Commit a44e5f7

Browse files
authored
replace find command in Jenkinsfile (#227)
1 parent 379ed3e commit a44e5f7

File tree

4 files changed

+55
-3
lines changed

4 files changed

+55
-3
lines changed

imagetool/src/main/resources/docker-files/Create_Image.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ RUN cd {{{tempDir}}}/opatch \
207207
-domain_type {{domainType}} \
208208
{{{wdtVariableFileArgument}}} {{{wdtModelFileArgument}}} {{{wdtArchiveFileArgument}}} \
209209
&& rm -rf {{{wdt_home}}}/weblogic-deploy/logs \
210-
&& find {{{wdt_home}}}/weblogic-deploy/lib/python -name "*.class" -exec rm {} \;
210+
&& shopt -s globstar && rm -f {{{wdt_home}}}/weblogic-deploy/lib/python/**/*.class
211211
{{/isWdtValidateEnabled}}
212212

213213
{{#afterWdtCommand}}

imagetool/src/main/resources/docker-files/Update_Image.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
-domain_type {{domainType}} \
7373
{{{wdtVariableFileArgument}}} {{{wdtModelFileArgument}}} {{{wdtArchiveFileArgument}}} \
7474
&& rm -rf {{{wdt_home}}}/weblogic-deploy/logs \
75-
&& find {{{wdt_home}}}/weblogic-deploy/lib/python -name "*.class" -exec rm {} \;
75+
&& shopt -s globstar && rm -f {{{wdt_home}}}/weblogic-deploy/lib/python/**/*.class
7676
{{/isWdtValidateEnabled}}
7777

7878
{{#afterWdtCommand}}

tests/src/test/java/com/oracle/weblogic/imagetool/tests/ITImagetool.java

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,4 +937,49 @@ void updateImageWithServerJRE(TestInfo testInfo) throws Exception {
937937
assertFalse(imageId.isEmpty(), "Image was not created: " + tagName);
938938
}
939939
}
940+
941+
/**
942+
* Create an image with WDT Model only on OL 8-slim
943+
*
944+
* @throws Exception - if any error occurs
945+
*/
946+
@Test
947+
@Order(28)
948+
@Tag("nightly")
949+
@DisplayName("Create Model in Image with OL 8-slim")
950+
void createMiiOl8slim(TestInfo testInfo) throws Exception {
951+
// test assumes that WDT installer is already in the cache from previous test
952+
953+
// test assumes that the WLS 12.2.1.3 installer is already in the cache
954+
955+
// test assumes that the default JDK version 8u202 is already in the cache
956+
957+
// test assumes that the WDT archive was already constructed
958+
959+
Path tmpWdtModel = Paths.get(wlsImgBldDir, WDT_MODEL1);
960+
961+
// update wdt model file
962+
Files.copy(WDT_RESOURCES.resolve(WDT_MODEL1), tmpWdtModel, StandardCopyOption.REPLACE_EXISTING);
963+
964+
try (PrintWriter out = getTestMethodWriter(testInfo)) {
965+
String tagName = build_tag + ":" + getMethodName(testInfo);
966+
String command = new CreateCommand()
967+
.tag(tagName)
968+
.fromImage(" oraclelinux", "8-slim")
969+
.version(WLS_VERSION)
970+
.wdtVersion(WDT_VERSION)
971+
.wdtArchive(WDT_ARCHIVE)
972+
.wdtModel(tmpWdtModel)
973+
.wdtModelOnly(true)
974+
.type("wls")
975+
.build();
976+
977+
CommandResult result = Runner.run(command, out, logger);
978+
assertEquals(0, result.exitValue(), "for command: " + command);
979+
980+
// verify the docker image is created
981+
String imageId = Runner.run("docker images -q " + tagName, out, logger).stdout().trim();
982+
assertFalse(imageId.isEmpty(), "Image was not created: " + tagName);
983+
}
984+
}
940985
}

tests/src/test/java/com/oracle/weblogic/imagetool/tests/utils/CreateCommand.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public class CreateCommand extends ImageToolCommand {
2929
private String wdtDomainHome;
3030
private String wdtDomainType;
3131
private boolean wdtRunRcu;
32+
private boolean wdtModelOnly;
3233

3334
public CreateCommand() {
3435
super("create");
@@ -129,6 +130,11 @@ public CreateCommand wdtRunRcu(boolean value) {
129130
return this;
130131
}
131132

133+
public CreateCommand wdtModelOnly(boolean value) {
134+
wdtModelOnly = value;
135+
return this;
136+
}
137+
132138
/**
133139
* Generate the command using the provided command line options.
134140
* @return the imagetool command as a string suitable for running in ProcessBuilder
@@ -152,6 +158,7 @@ public String build() {
152158
+ field("--wdtVariables", wdtVariables)
153159
+ field("--wdtDomainHome", wdtDomainHome)
154160
+ field("--wdtDomainType", wdtDomainType)
155-
+ field("--wdtRunRCU", wdtRunRcu);
161+
+ field("--wdtRunRCU", wdtRunRcu)
162+
+ field("--wdtModelOnly", wdtModelOnly);
156163
}
157164
}

0 commit comments

Comments
 (0)