Skip to content

Commit 2f0e050

Browse files
committed
Merge branch 'xc-108837' into 'release/4.0'
backport mr 4201 to release/4.0 See merge request weblogic-cloud/weblogic-kubernetes-operator!4211
2 parents c2604cc + 521b81a commit 2f0e050

File tree

4 files changed

+39
-12
lines changed

4 files changed

+39
-12
lines changed

integration-tests/pom.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
<wko.it.opdemo>${env.opdemo}</wko.it.opdemo>
7474
<wko.it.image.name.operator>${env.IMAGE_NAME_OPERATOR}</wko.it.image.name.operator>
7575
<wko.it.image.tag.operator>${env.IMAGE_TAG_OPERATOR}</wko.it.image.tag.operator>
76+
<wko.it.crio.pipeline.image>${env.DOCKER_IMAGE}</wko.it.crio.pipeline.image>
7677
<includes-failsafe>**/It*</includes-failsafe>
7778
</properties>
7879

@@ -144,7 +145,7 @@
144145
<property>wko.it.base.images.tenancy</property>
145146
<message>Set the wko.it.base.images.tenancy property to specify the tenancy to use to pull base weblogic/fmw images.</message>
146147
<regex>^[a-zA-Z0-9_]+.*$</regex>
147-
<regexMessage>The wko.it.base.images.repo must start with an alphanumeric character</regexMessage>
148+
<regexMessage>The wko.it.base.images.tenancy must start with an alphanumeric character</regexMessage>
148149
</requireProperty>
149150
<requireEnvironmentVariable>
150151
<message>Set the BASE_IMAGES_REPO_USERNAME environment variable to create pull secret for BASE_IMAGES_REPO.</message>
@@ -168,7 +169,7 @@
168169
<property>wko.it.test.images.tenancy</property>
169170
<message>Set the wko.it.test.images.tenancy property to specify the tenancy to use to pull local infra images and domain images.</message>
170171
<regex>^[a-zA-Z0-9_]+.*$</regex>
171-
<regexMessage>The wko.it.test.images.repo must start with an alphanumeric character</regexMessage>
172+
<regexMessage>The wko.it.test.images.tenancy must start with an alphanumeric character</regexMessage>
172173
</requireProperty>
173174
<requireEnvironmentVariable>
174175
<message>Set the TEST_IMAGES_REPO_USERNAME environment variable to create pull secret for TEST_IMAGES_REPO.</message>
@@ -270,6 +271,7 @@
270271
<wko.it.image.tag.operator>${wko.it.image.tag.operator}</wko.it.image.tag.operator>
271272
<wko.it.base.images.tenancy>${wko.it.base.images.tenancy}</wko.it.base.images.tenancy>
272273
<wko.it.test.images.tenancy>${wko.it.test.images.tenancy}</wko.it.test.images.tenancy>
274+
<wko.it.crio.pipeline.image>${wko.it.crio.pipeline.image}</wko.it.crio.pipeline.image>
273275
</systemPropertyVariables>
274276
<trimStackTrace>false</trimStackTrace>
275277
</configuration>

integration-tests/src/test/java/oracle/weblogic/kubernetes/TestConstants.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getDateAndTimeStamp;
1212
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getDomainImagePrefix;
1313
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getEnvironmentProperty;
14+
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getImageRepoFromImageName;
1415
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getKindRepoImageForSpec;
1516
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getKindRepoValue;
1617
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getNonEmptySystemProperty;
@@ -60,11 +61,15 @@ public interface TestConstants {
6061
// kind constants
6162
public static final String KIND_REPO = getKindRepoValue("wko.it.kind.repo");
6263

64+
// crio pipeline constants
65+
public static final String CRIO_PIPELINE_IMAGE = System.getProperty("wko.it.crio.pipeline.image");
66+
6367
// BASE_IMAGES_REPO represents the repository from where all the base WebLogic
6468
// and InfraStructure images are pulled
65-
//
66-
public static final String BASE_IMAGES_REPO = System.getProperty("wko.it.base.images.repo");
69+
public static final String BASE_IMAGES_REPO = Optional.ofNullable(getImageRepoFromImageName(CRIO_PIPELINE_IMAGE))
70+
.orElse(System.getProperty("wko.it.base.images.repo"));
6771
public static final String BASE_IMAGES_TENANCY = System.getProperty("wko.it.base.images.tenancy");
72+
public static final String BASE_IMAGES_PREFIX = getDomainImagePrefix(BASE_IMAGES_REPO, BASE_IMAGES_TENANCY);
6873

6974
public static final String BASE_IMAGES_REPO_USERNAME = System.getenv("BASE_IMAGES_REPO_USERNAME");
7075
public static final String BASE_IMAGES_REPO_PASSWORD = System.getenv("BASE_IMAGES_REPO_PASSWORD");
@@ -75,7 +80,8 @@ public interface TestConstants {
7580
// images such as nginx,elasticsearch,Oracle DB operator (b) all test domain
7681
// images to be pushed into it.
7782
//
78-
public static final String TEST_IMAGES_REPO = System.getProperty("wko.it.test.images.repo");
83+
public static final String TEST_IMAGES_REPO = Optional.ofNullable(getImageRepoFromImageName(CRIO_PIPELINE_IMAGE))
84+
.orElse(System.getProperty("wko.it.test.images.repo"));
7985
public static final String TEST_IMAGES_TENANCY = System.getProperty("wko.it.test.images.tenancy");
8086

8187
public static final String TEST_IMAGES_REPO_USERNAME = System.getenv("TEST_IMAGES_REPO_USERNAME");
@@ -106,21 +112,21 @@ public interface TestConstants {
106112
// Get WEBLOGIC_IMAGE_NAME/WEBLOGIC_IMAGE_TAG from env var,
107113
// if its not provided use OCIR default image values
108114
//
109-
public static final String WEBLOGIC_IMAGE_NAME = BASE_IMAGES_REPO + "/" + BASE_IMAGES_TENANCY + "/"
115+
public static final String WEBLOGIC_IMAGE_NAME = BASE_IMAGES_PREFIX
110116
+ getNonEmptySystemProperty("wko.it.weblogic.image.name", WEBLOGIC_IMAGE_NAME_DEFAULT);
111117
public static final String WEBLOGIC_IMAGE_TAG = getNonEmptySystemProperty("wko.it.weblogic.image.tag",
112118
WEBLOGIC_IMAGE_TAG_DEFAULT);
113119

114120
// Get FMWINFRA_IMAGE_NAME/FMWINFRA_IMAGE_TAG from env var, if its not
115121
// provided and if base images repo is OCIR use OCIR default image values
116-
public static final String FMWINFRA_IMAGE_NAME = BASE_IMAGES_REPO + "/" + BASE_IMAGES_TENANCY + "/"
122+
public static final String FMWINFRA_IMAGE_NAME = BASE_IMAGES_PREFIX
117123
+ getNonEmptySystemProperty("wko.it.fmwinfra.image.name", FMWINFRA_IMAGE_NAME_DEFAULT);
118124
public static final String FMWINFRA_IMAGE_TAG = getNonEmptySystemProperty("wko.it.fmwinfra.image.tag",
119125
FMWINFRA_IMAGE_TAG_DEFAULT);
120126

121127
// Get DB_IMAGE_NAME/DB_IMAGE_TAG from env var, if its not provided and
122128
// if base images repo is OCIR use OCIR default image values
123-
public static final String DB_IMAGE_NAME = BASE_IMAGES_REPO + "/" + BASE_IMAGES_TENANCY + "/"
129+
public static final String DB_IMAGE_NAME = BASE_IMAGES_PREFIX
124130
+ getNonEmptySystemProperty("wko.it.db.image.name", DB_IMAGE_NAME_DEFAULT);
125131
public static final String DB_IMAGE_TAG = getNonEmptySystemProperty("wko.it.db.image.tag", DB_IMAGE_TAG_DEFAULT);
126132

@@ -201,7 +207,7 @@ public interface TestConstants {
201207
public static final String APACHE_IMAGE_TAG_DEFAULT = "12.2.1.4";
202208

203209
// Get APACHE_IMAGE_NAME/APACHE_IMAGE_TAG from env var, if it is not provided use OCIR default image values
204-
public static final String APACHE_IMAGE_NAME = BASE_IMAGES_REPO + "/" + BASE_IMAGES_TENANCY + "/"
210+
public static final String APACHE_IMAGE_NAME = BASE_IMAGES_PREFIX
205211
+ getNonEmptySystemProperty("wko.it.apache.image.name", APACHE_IMAGE_NAME_DEFAULT);
206212
public static final String APACHE_IMAGE_TAG =
207213
getNonEmptySystemProperty("wko.it.apache.image.tag", APACHE_IMAGE_TAG_DEFAULT);
@@ -402,8 +408,7 @@ public interface TestConstants {
402408
public static final String ORACLE_DB_OPERATOR_RELEASE_LATEST = "release/0.2.0";
403409
public static final String ORACLE_DB_OPERATOR_RELEASE =
404410
getNonEmptySystemProperty("wko.it.oracle.db.operator.release", ORACLE_DB_OPERATOR_RELEASE_LATEST);
405-
public static final String DB_OPERATOR_IMAGE = BASE_IMAGES_REPO + "/" + BASE_IMAGES_TENANCY
406-
+ "/test-images/database/operator:0.2.0";
411+
public static final String DB_OPERATOR_IMAGE = BASE_IMAGES_PREFIX + "test-images/database/operator:0.2.0";
407412
public static final String CERT_MANAGER
408413
= "https://github.com/jetstack/cert-manager/releases/latest/download/cert-manager.yaml";
409414
public static final String DB_OPERATOR_YAML_URL = "https://raw.githubusercontent.com/"

integration-tests/src/test/java/oracle/weblogic/kubernetes/actions/impl/Operator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import oracle.weblogic.kubernetes.actions.impl.primitive.Image;
1313

1414
import static oracle.weblogic.kubernetes.TestConstants.BUILD_ID;
15+
import static oracle.weblogic.kubernetes.TestConstants.DOMAIN_IMAGES_PREFIX;
1516
import static oracle.weblogic.kubernetes.TestConstants.DOMAIN_IMAGES_REPO;
1617
import static oracle.weblogic.kubernetes.TestConstants.IMAGE_NAME_OPERATOR;
1718
import static oracle.weblogic.kubernetes.TestConstants.IMAGE_TAG_OPERATOR;
@@ -67,7 +68,7 @@ public static String getImageName() {
6768
String imageTag = "";
6869
// use branch name and build id for Jenkins runs in image tag
6970
if (!DOMAIN_IMAGES_REPO.isEmpty()) {
70-
imageName = DOMAIN_IMAGES_REPO + imageName;
71+
imageName = DOMAIN_IMAGES_PREFIX + imageName;
7172
}
7273
String branchName = "";
7374
if (!BUILD_ID.isEmpty()) {

integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonTestUtils.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,4 +1840,23 @@ public static String getInstallerFileName(
18401840
return "";
18411841
}
18421842
}
1843+
1844+
/**
1845+
* Get the image repo from an image name.
1846+
* @param imageName the image name
1847+
* @return image repo
1848+
*/
1849+
public static String getImageRepoFromImageName(String imageName) {
1850+
1851+
String imageRepo = null;
1852+
if (imageName != null && imageName.contains("/")) {
1853+
getLogger().info("Getting image repo from imageName {0}", imageName);
1854+
int indexOfSlash = imageName.indexOf("/");
1855+
imageRepo = imageName.substring(0, indexOfSlash);
1856+
} else {
1857+
getLogger().info("Can not get the image repo from imageName {0}", imageName);
1858+
}
1859+
1860+
return imageRepo;
1861+
}
18431862
}

0 commit comments

Comments
 (0)