Skip to content

Commit e3115a2

Browse files
committed
Merge branch 'server-jre-ocir' into 'main'
Allow Jenkins to override location of ServerJRE container image for integration tests See merge request weblogic-cloud/weblogic-image-tool!448
2 parents 69ea135 + 71683b1 commit e3115a2

File tree

5 files changed

+25
-16
lines changed

5 files changed

+25
-16
lines changed

Jenkinsfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pipeline {
1717
// variables for SystemTest stages (integration tests)
1818
STAGING_DIR = "${WORKSPACE}/wit-system-test-files"
1919
DB_IMAGE = "${WKT_OCIR_HOST}/${WKT_TENANCY}/database/enterprise:12.2.0.1-slim"
20+
JRE_IMAGE = "${WKT_OCIR_HOST}/${WKT_TENANCY}/java/serverjre:8"
2021
}
2122

2223
stages {
@@ -99,7 +100,7 @@ pipeline {
99100
withMaven(globalMavenSettingsConfig: 'wkt-maven-settings-xml', publisherStrategy: 'EXPLICIT') {
100101
sh '''
101102
cd tests
102-
mvn -B clean verify -Dtest.staging.dir=${STAGING_DIR} -Dtest.groups=gate -DskipITs=false
103+
mvn -B clean verify -Dtest.groups=gate -DskipITs=false
103104
'''
104105
}
105106
}
@@ -123,12 +124,13 @@ pipeline {
123124
steps {
124125
script {
125126
docker.image("${env.DB_IMAGE}").pull()
127+
docker.image("${env.JRE_IMAGE}").pull()
126128
}
127129
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'wkt-otn-credential', passwordVariable: 'ORACLE_SUPPORT_PASSWORD', usernameVariable: 'ORACLE_SUPPORT_USERNAME']]) {
128130
withMaven(globalMavenSettingsConfig: 'wkt-maven-settings-xml', publisherStrategy: 'EXPLICIT') {
129131
sh '''
130132
cd tests
131-
mvn -B clean verify -Dtest.staging.dir=${STAGING_DIR} -Dtest.groups=gate,nightly -DskipITs=false
133+
mvn -B clean verify -Dtest.groups=gate,nightly -DskipITs=false
132134
'''
133135
}
134136
}

installer/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
<goal>single</goal>
5151
</goals>
5252
<configuration>
53-
<finalName>imagetool</finalName>
5453
<descriptors>
5554
<descriptor>src/assembly/zip.xml</descriptor>
5655
</descriptors>

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@
3737
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3838
<maven.compiler.source>1.8</maven.compiler.source>
3939
<maven.compiler.target>1.8</maven.compiler.target>
40+
4041
<test.groups>gate</test.groups>
4142
<skipITs>true</skipITs>
43+
<test.staging.dir>${env.STAGING_DIR}</test.staging.dir>
44+
<test.db.image>${env.DB_IMAGE}</test.db.image>
45+
<test.java.image>${env.JRE_IMAGE}</test.java.image>
4246
</properties>
4347

4448
<modules>
@@ -91,6 +95,7 @@
9195
</dependencyManagement>
9296

9397
<build>
98+
<finalName>imagetool</finalName>
9499
<plugins>
95100
<plugin>
96101
<groupId>org.apache.maven.plugins</groupId>
@@ -113,10 +118,6 @@
113118
<variableName>ORACLE_SUPPORT_PASSWORD</variableName>
114119
<message>For integration tests, you must set the environment variable ORACLE_SUPPORT_PASSWORD to match the ORACLE_SUPPORT_USERNAME credential.</message>
115120
</requireEnvironmentVariable>
116-
<requireEnvironmentVariable>
117-
<variableName>DB_IMAGE</variableName>
118-
<message>For integration tests, you must set the environment variable DB_IMAGE to a database container image.</message>
119-
</requireEnvironmentVariable>
120121
<requireProperty>
121122
<property>test.staging.dir</property>
122123
<message>For integration tests, you must define the test.staging.dir System property to point to the directory where the installers are staged. Or, set STAGING_DIR environment variable.</message>
@@ -134,7 +135,6 @@
134135
<artifactId>maven-jar-plugin</artifactId>
135136
<version>3.3.0</version>
136137
<configuration>
137-
<finalName>${project.artifactId}</finalName>
138138
<archive>
139139
<manifest>
140140
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>

tests/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@
9191
<WLSIMG_BLDDIR>${project.build.directory}/blddir</WLSIMG_BLDDIR>
9292
<WLSIMG_CACHEDIR>${project.build.directory}/cachedir</WLSIMG_CACHEDIR>
9393
<STAGING_DIR>${test.staging.dir}</STAGING_DIR>
94-
<DB_IMAGE>${env.DB_IMAGE}</DB_IMAGE>
94+
<DB_IMAGE>${test.db.image}</DB_IMAGE>
95+
<JRE_IMAGE>${test.java.image}</JRE_IMAGE>
9596
</systemPropertyVariables>
9697
</configuration>
9798
<executions>

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ class ITImagetool {
5656
private static final String wlsImgCacheDir = System.getProperty("WLSIMG_CACHEDIR");
5757

5858
// Docker images
59-
private static final String DB_IMAGE = System.getProperty("DB_IMAGE");
59+
private static String DB_IMAGE = System.getProperty("DB_IMAGE");
60+
private static String JRE_IMAGE = System.getProperty("JRE_IMAGE");
6061

6162
// Staging Dir files
6263
private static final String JDK_INSTALLER = "jdk-8u202-linux-x64.tar.gz";
@@ -103,16 +104,22 @@ private static void validateEnvironmentSettings() {
103104
missingSettings.add("STAGING_DIR");
104105
}
105106

106-
if (Utils.isEmptyString(DB_IMAGE)) {
107-
missingSettings.add("DB_IMAGE");
108-
}
109-
110107
if (missingSettings.size() > 0) {
111108
String error = String.join(", ", missingSettings)
112109
+ " must be set as a system property in the pom.xml";
113110
throw new IllegalArgumentException(error);
114111
}
115112

113+
if (Utils.isEmptyString(DB_IMAGE)) {
114+
//default to container-registry.oracle.com image
115+
DB_IMAGE = "container-registry.oracle.com/database/enterprise:12.2.0.1-slim";
116+
}
117+
118+
if (Utils.isEmptyString(JRE_IMAGE)) {
119+
//default to container-registry.oracle.com image
120+
JRE_IMAGE = "container-registry.oracle.com/java/serverjre:8";
121+
}
122+
116123
// get the build tag from Jenkins build environment variable BUILD_TAG
117124
build_tag = System.getenv("BUILD_TAG");
118125
if (build_tag != null) {
@@ -126,6 +133,7 @@ private static void validateEnvironmentSettings() {
126133
logger.info("WLSIMG_CACHEDIR = " + wlsImgCacheDir);
127134
logger.info("STAGING_DIR = " + STAGING_DIR);
128135
logger.info("DB_IMAGE = " + DB_IMAGE);
136+
logger.info("JRE_IMAGE = " + JRE_IMAGE);
129137
}
130138

131139
private static void verifyStagedFiles(String... installers) {
@@ -791,7 +799,6 @@ void createFmwImgFullInternetAccess(TestInfo testInfo) throws Exception {
791799

792800
/**
793801
* create a JRF domain image using WDT
794-
* You need to have OCR credentials to pull container-registry.oracle.com/database/enterprise:12.2.0.1-slim
795802
*
796803
* @throws Exception - if any error occurs
797804
*/
@@ -975,7 +982,7 @@ void createImageWithServerJRE(TestInfo testInfo) throws Exception {
975982
String tagName = build_tag + ":" + getMethodName(testInfo);
976983
String command = new CreateCommand()
977984
.tag(tagName)
978-
.fromImage("container-registry.oracle.com/java/serverjre:8")
985+
.fromImage(JRE_IMAGE)
979986
.build();
980987

981988
try (PrintWriter out = getTestMethodWriter(testInfo)) {

0 commit comments

Comments
 (0)