Skip to content

Commit 09fc488

Browse files
committed
Merge remote-tracking branch 'origin/imagetestchanges' into release/2.2
2 parents 8f480c9 + 9e7a2a9 commit 09fc488

File tree

10 files changed

+110
-30
lines changed

10 files changed

+110
-30
lines changed

integration-tests/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ K8sTestUtils - uses k8s java client api, this is used only for delete domain use
180180

181181
* Maven and latest Git should be in PATH
182182
* export JAVA_HOME
183-
* export WEBLOGIC_IMAGE_NAME and WEBLOGIC_IMAGE_TAG if different from store/oracle/weblogic and 12.2.1.3
183+
* export WEBLOGIC_IMAGE_NAME and WEBLOGIC_IMAGE_TAG if different from middleware/weblogic and 12.2.1.3-190111
184184
* Setup docker access to WebLogic 12c Images
185185

186186
Method 1
@@ -194,7 +194,7 @@ K8sTestUtils - uses k8s java client api, this is used only for delete domain use
194194
```
195195

196196
Method 2
197-
- Make sure the weblogic image i.e. store/oracle/weblogic:12.2.1.3 already exists locally in a docker repository the k8s cluster can access
197+
- Make sure the weblogic image i.e. middleware/weblogic:12.2.1.3-190111 already exists locally in a docker repository the k8s cluster can access
198198
- Make sure the weblogic image has patch p29135930 (required for the WebLogic Kubernetes Operator).
199199
- If not, see [https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-patch-wls-for-k8s].
200200

integration-tests/USECASES.MD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Basic Use Cases described above are verified in all the domain configurations. A
6868
| Server Pods Restarted by modifying properties on the domain resource| Use Case |
6969
| --- | --- |
7070
| Server pods restarted by changing Env property | Verify admin and managed server pods being restarted by property change: `-Dweblogic.StdoutDebugEnabled=false` --> `-Dweblogic.StdoutDebugEnabled=true` |
71-
| Server pods restarted by changing image | Verify admin and managed server pods being restarted by property change: image: `store/oracle/weblogic:12.2.1.3` --> image: `store/oracle/weblogic:duplicate` |
71+
| Server pods restarted by changing image | Verify admin and managed server pods being restarted by property change: image: `container-registry.oracle.com/middleware/weblogic:12.2.1.3-190111` --> image: `container-registry.oracle.com/middleware/weblogic:duplicate` |
7272
| Server pods restarted by changing imagePullPolicy | Verify admin and managed server pods being restarted by property change: imagePullPolicy: IfNotPresent --> imagePullPolicy: Never |
7373
| Server pods restarted by changing includeServerOutInPodLog | Verify admin and managed server pods being restarted by property change: includeServerOutInPodLog: true --> includeServerOutInPodLog: false |
7474
| Server pods restarted by changing logHomeEnable | Verify admin and managed server pods being restarted by property change: logHomeEnabled: true --> logHomeEnabled: false |

integration-tests/src/test/java/oracle/kubernetes/operator/BaseTest.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public class BaseTest {
6969
protected static String appLocationInPod = "/u01/oracle/apps";
7070
private static String appLocationOnHost;
7171
private static Properties appProps;
72+
private static String weblogicImageTag;
73+
private static String weblogicImageName;
7274

7375
// Set QUICKTEST env var to true to run a small subset of tests.
7476
// Set SMOKETEST env var to true to run an even smaller subset of tests
@@ -104,6 +106,14 @@ public static void initialize(String appPropsFile) throws Exception {
104106
}
105107
username = appProps.getProperty("username", username);
106108
password = appProps.getProperty("password", password);
109+
weblogicImageTag =
110+
System.getenv("IMAGE_TAG_WEBLOGIC") != null
111+
? System.getenv("IMAGE_TAG_WEBLOGIC")
112+
: appProps.getProperty("weblogicImageTag");
113+
weblogicImageName =
114+
System.getenv("IMAGE_NAME_WEBLOGIC") != null
115+
? System.getenv("IMAGE_NAME_WEBLOGIC")
116+
: appProps.getProperty("weblogicImageName");
107117
maxIterationsPod =
108118
new Integer(appProps.getProperty("maxIterationsPod", "" + maxIterationsPod)).intValue();
109119
waitTimePod = new Integer(appProps.getProperty("waitTimePod", "" + waitTimePod)).intValue();
@@ -227,6 +237,23 @@ public static void initialize(String appPropsFile) throws Exception {
227237
logger.info("Env var BRANCH_NAME " + System.getenv("BRANCH_NAME"));
228238
}
229239

240+
/**
241+
* getter method for weblogicImageTag field
242+
*
243+
* @return image tag of the WLS docker images
244+
*/
245+
public static String getWeblogicImageTag() {
246+
return weblogicImageTag;
247+
}
248+
249+
/**
250+
* getter method for weblogicImageName
251+
*
252+
* @return image name of the WLS docker image
253+
*/
254+
public static String getWeblogicImageName() {
255+
return weblogicImageName;
256+
}
230257
/**
231258
* Call the basic usecases tests
232259
*

integration-tests/src/test/java/oracle/kubernetes/operator/ITPodsRestart.java

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ public void testServerPodsRestartByChangingIncludeServerOutInPodLog() throws Exc
184184
/**
185185
* Modify the domain scope property on the domain resource using kubectl apply -f domain.yaml
186186
* Verify that all the server pods in the domain got re-started .The property tested is: image:
187-
* "store/oracle/weblogic:12.2.1.3" --> image: "store/oracle/weblogic:duplicate"
187+
* "container-registry.oracle.com/middleware/weblogic:12.2.1.3-190111" --> image:
188+
* "container-registry.oracle.com/middleware/weblogic:duplicate"
188189
*
189190
* @throws Exception
190191
*/
@@ -198,14 +199,19 @@ public void testServerPodsRestartByChangingZImage() throws Exception {
198199
logger.info(
199200
"About to verifyDomainServerPodRestart for Domain: "
200201
+ domain.getDomainUid()
201-
+ " Image property: store/oracle/weblogic:12.2.1.3 to store/oracle/weblogic:duplicate");
202+
+ " Image property: "
203+
+ getWeblogicImageName()
204+
+ ":"
205+
+ getWeblogicImageTag()
206+
+ " to /weblogick8s/middleware/weblogic:duplicate");
202207

203208
if (BaseTest.SHARED_CLUSTER) {
204209
String newImage =
205-
System.getenv("REPO_REGISTRY") + "/weblogick8s/store/oracle/weblogic:duplicate";
210+
System.getenv("REPO_REGISTRY") + "/weblogick8s/middleware/weblogic:duplicate";
206211

207212
// tag image with repo name
208-
TestUtils.exec("docker tag store/oracle/weblogic:12.2.1.3 " + newImage);
213+
TestUtils.exec(
214+
"docker tag " + getWeblogicImageName() + ":" + getWeblogicImageTag() + " " + newImage);
209215

210216
// login and push image to ocir
211217
TestUtils.loginAndPushImageToOCIR(newImage);
@@ -222,15 +228,24 @@ public void testServerPodsRestartByChangingZImage() throws Exception {
222228

223229
// apply new domain yaml and verify pod restart
224230
domain.verifyDomainServerPodRestart(
225-
"\"store/oracle/weblogic:12.2.1.3\"", "\"" + newImage + "\"");
231+
"\"" + getWeblogicImageName() + ":" + getWeblogicImageTag() + "\"",
232+
"\"" + newImage + "\"");
226233
} else {
227-
TestUtils.exec("docker tag store/oracle/weblogic:12.2.1.3 store/oracle/weblogic:duplicate");
234+
TestUtils.exec(
235+
"docker tag "
236+
+ getWeblogicImageName()
237+
+ ":"
238+
+ getWeblogicImageTag()
239+
+ " "
240+
+ getWeblogicImageName()
241+
+ ":duplicate");
228242
domain.verifyDomainServerPodRestart(
229-
"\"store/oracle/weblogic:12.2.1.3\"", "\"store/oracle/weblogic:duplicate\"");
243+
"\"" + getWeblogicImageName() + ":" + getWeblogicImageTag() + "\"",
244+
"\"" + getWeblogicImageName() + ":duplicate" + "\"");
230245
}
231246
} finally {
232247
if (!BaseTest.SHARED_CLUSTER) {
233-
TestUtils.exec("docker rmi -f store/oracle/weblogic:duplicate");
248+
TestUtils.exec("docker rmi -f " + getWeblogicImageName() + ":duplicate");
234249
}
235250
}
236251

integration-tests/src/test/java/oracle/kubernetes/operator/utils/Domain.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ public class Domain {
6161
protected String userProjectsDir = "";
6262
private String projectRoot = "";
6363
private boolean ingressPerDomain = true;
64-
private String imageTag = "12.2.1.3";
65-
private String imageName = "store/oracle/weblogic";
64+
private String imageTag;
65+
private String imageName;
6666

6767
protected String generatedInputYamlFile;
6868

@@ -1384,6 +1384,8 @@ private void callWebAppAndCheckForServerNameInResponse(
13841384
* accessed to read or if creating config map or secret fails for configoverrides
13851385
*/
13861386
protected void initialize(Map<String, Object> inputDomainMap) throws Exception {
1387+
imageTag = BaseTest.getWeblogicImageTag();
1388+
imageName = BaseTest.getWeblogicImageName();
13871389
domainMap = inputDomainMap;
13881390
this.userProjectsDir = BaseTest.getUserProjectsDir();
13891391
this.projectRoot = BaseTest.getProjectRoot();

integration-tests/src/test/resources/OperatorIT.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ username=weblogic
77
password=welcome1
88
maxIterationsPod=25
99
waitTimePod=10
10+
weblogicImageTag = 12.2.1.3-190111
11+
weblogicImageName = container-registry.oracle.com/middleware/weblogic

integration-tests/src/test/resources/domaininimagewdt.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ exposeAdminT3Channel: true
99
exposeAdminNodePort: true
1010
voyagerWebPort: 30333
1111
domainHomeImageBuildPath: ./docker-images/OracleWebLogic/samples/12213-domain-home-in-image-wdt
12-
domainHomeImageBase: "store/oracle/weblogic:12.2.1.3"
12+
domainHomeImageBase: "container-registry.oracle.com/middleware/weblogic:12.2.1.3-190111"
1313
logHomeOnPV: true
1414
clusterType: CONFIGURED

integration-tests/src/test/resources/domaininimagewlst.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ exposeAdminT3Channel: true
99
exposeAdminNodePort: true
1010
voyagerWebPort: 30322
1111
domainHomeImageBuildPath: ./docker-images/OracleWebLogic/samples/12213-domain-home-in-image
12-
domainHomeImageBase: "store/oracle/weblogic:12.2.1.3"
12+
domainHomeImageBase: "container-registry.oracle.com/middleware/weblogic:12.2.1.3-190111"
1313
logHomeOnPV: true

integration-tests/src/test/resources/setupenv.sh

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/bash -x
22
# Copyright 2018, Oracle Corporation and/or its affiliates. All rights reserved.
33
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
44

@@ -45,6 +45,35 @@ function setup_jenkins {
4545
echo "Helm is configured."
4646
}
4747

48+
function docker_login {
49+
50+
set +x
51+
if [ -z "$DOCKER_USERNAME" ] || [ -z "$DOCKER_PASSWORD" ]; then
52+
echo "DOCKER_USERNAME and DOCKER_PASSWORD not set !!!"
53+
exit 1
54+
fi
55+
56+
if [ -n "$DOCKER_USERNAME" ] && [ -n "$DOCKER_PASSWORD" ]; then
57+
echo "Creating Docker Secret"
58+
59+
kubectl create secret docker-registry $IMAGE_PULL_SECRET_WEBLOGIC \
60+
--docker-server=index.docker.io/v1/ \
61+
--docker-username=$DOCKER_USERNAME \
62+
--docker-password=$DOCKER_PASSWORD
63+
64+
echo "Checking Secret"
65+
SECRET="`kubectl get secret $IMAGE_PULL_SECRET_WEBLOGIC | grep $IMAGE_PULL_SECRET_WEBLOGIC | wc | awk ' { print $1; }'`"
66+
if [ "$SECRET" != "1" ]; then
67+
echo "secret $IMAGE_PULL_SECRET_WEBLOGIC was not created successfully"
68+
exit 1
69+
fi
70+
# below docker pull is needed to get wlthint3client.jar from image to put in the classpath
71+
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
72+
fi
73+
set -x
74+
75+
}
76+
4877
function setup_shared_cluster {
4978
echo "Perform setup for running on shared cluster"
5079
echo "Install tiller"
@@ -76,21 +105,20 @@ function clean_shared_cluster {
76105
function pull_tag_images {
77106

78107
set +x
79-
if [ -z "$DOCKER_USERNAME" ] || [ -z "$DOCKER_PASSWORD" ] || [ -z "$DOCKER_EMAIL" ]; then
108+
if [ -z "$OCR_USERNAME" ] || [ -z "$OCR_PASSWORD" ]; then
80109
if [ -z $(docker images -q $IMAGE_NAME_WEBLOGIC:$IMAGE_TAG_WEBLOGIC) ]; then
81-
echo "Image $IMAGE_NAME_WEBLOGIC:$IMAGE_TAG_WEBLOGIC doesn't exist. Provide Docker login details using env variables DOCKER_USERNAME, DOCKER_PASSWORD and DOCKER_EMAIL to pull the image."
110+
echo "Image $IMAGE_NAME_WEBLOGIC:$IMAGE_TAG_WEBLOGIC doesn't exist. Provide Docker login details using env variables OCR_USERNAME and OCR_PASSWORD to pull the image."
82111
exit 1
83112
fi
84113
fi
85114

86-
if [ -n "$DOCKER_USERNAME" ] && [ -n "$DOCKER_PASSWORD" ] && [ -n "$DOCKER_EMAIL" ]; then
115+
if [ -n "$OCR_USERNAME" ] && [ -n "$OCR_PASSWORD" ]; then
87116
echo "Creating Docker Secret"
88117

89118
kubectl create secret docker-registry $IMAGE_PULL_SECRET_WEBLOGIC \
90-
--docker-server=index.docker.io/v1/ \
91-
--docker-username=$DOCKER_USERNAME \
92-
--docker-password=$DOCKER_PASSWORD \
93-
--docker-email=$DOCKER_EMAIL
119+
--docker-server=${WL_DOCKER_SERVER}/ \
120+
--docker-username=$OCR_USERNAME \
121+
--docker-password=$OCR_PASSWORD
94122

95123
echo "Checking Secret"
96124
SECRET="`kubectl get secret $IMAGE_PULL_SECRET_WEBLOGIC | grep $IMAGE_PULL_SECRET_WEBLOGIC | wc | awk ' { print $1; }'`"
@@ -99,7 +127,9 @@ function pull_tag_images {
99127
exit 1
100128
fi
101129
# below docker pull is needed to get wlthint3client.jar from image to put in the classpath
102-
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
130+
echo "docker login -u $OCR_USERNAME -p $OCR_PASSWORD ${WL_DOCKER_SERVER}"
131+
docker login -u $OCR_USERNAME -p $OCR_PASSWORD ${WL_DOCKER_SERVER}
132+
echo "docker pull $IMAGE_NAME_WEBLOGIC:$IMAGE_TAG_WEBLOGIC"
103133
docker pull $IMAGE_NAME_WEBLOGIC:$IMAGE_TAG_WEBLOGIC
104134
fi
105135
set -x
@@ -179,13 +209,15 @@ function get_wlthint3client_from_image {
179209
docker rm -v $id
180210

181211
}
212+
export WL_DOCKER_SERVER=container-registry.oracle.com
213+
export WLS_IMAGE_URI=/middleware/weblogic
182214
export SCRIPTPATH="$( cd "$(dirname "$0")" > /dev/null 2>&1 ; pwd -P )"
183215
export PROJECT_ROOT="$SCRIPTPATH/../../../.."
184216
export RESULT_ROOT=${RESULT_ROOT:-/scratch/$USER/wl_k8s_test_results}
185217
export PV_ROOT=${PV_ROOT:-$RESULT_ROOT}
186218
echo "RESULT_ROOT$RESULT_ROOT PV_ROOT$PV_ROOT"
187219
export BRANCH_NAME="${BRANCH_NAME:-$SHARED_CLUSTER_GIT_BRANCH}"
188-
export IMAGE_TAG_WEBLOGIC="${IMAGE_TAG_WEBLOGIC:-12.2.1.3}"
220+
export IMAGE_TAG_WEBLOGIC="${IMAGE_TAG_WEBLOGIC:-12.2.1.3-190111}"
189221

190222
if [ "$JRF_ENABLED" = true ] ; then
191223
export IMAGE_NAME_WEBLOGIC="${IMAGE_NAME_WEBLOGIC:-phx.ocir.io/weblogick8s/oracle/fmw-infrastructure}"
@@ -195,7 +227,7 @@ if [ "$JRF_ENABLED" = true ] ; then
195227
export IMAGE_PULL_SECRET_ORACLEDB="${IMAGE_PULL_SECRET_ORACLEDB:-docker-store}"
196228

197229
fi
198-
export IMAGE_NAME_WEBLOGIC="${IMAGE_NAME_WEBLOGIC:-store/oracle/weblogic}"
230+
export IMAGE_NAME_WEBLOGIC="${IMAGE_NAME_WEBLOGIC:-`echo ${WL_DOCKER_SERVER}``echo ${WLS_IMAGE_URI}`}"
199231
export IMAGE_PULL_SECRET_WEBLOGIC="${IMAGE_PULL_SECRET_WEBLOGIC:-docker-store}"
200232

201233
if [ -z "$BRANCH_NAME" ]; then
@@ -219,6 +251,8 @@ fi
219251
export JAR_VERSION="`grep -m1 "<version>" pom.xml | cut -f2 -d">" | cut -f1 -d "<"`"
220252

221253
echo IMAGE_NAME_OPERATOR $IMAGE_NAME_OPERATOR IMAGE_TAG_OPERATOR $IMAGE_TAG_OPERATOR JAR_VERSION $JAR_VERSION
254+
255+
#docker_login
222256

223257
if [ "$SHARED_CLUSTER" = "true" ]; then
224258

@@ -254,14 +288,14 @@ if [ "$SHARED_CLUSTER" = "true" ]; then
254288
fi
255289
fi
256290

257-
if [ -z "$DOCKER_USERNAME" ] || [ -z "$DOCKER_PASSWORD" ] || [ -z "$DOCKER_EMAIL" ]; then
258-
echo "Provide Docker login details using DOCKER_USERNAME, DOCKER_PASSWORD & DOCKER_EMAIL env variables to push the Operator image to the repository."
291+
if [ -z "$OCR_USERNAME" ] || [ -z "$OCR_PASSWORD" ]; then
292+
echo "Provide Docker login details using OCR_USERNAME & OCR_PASSWORD env variables to push the Operator image to the repository."
259293
exit 1
260294
fi
261295

262296
echo "Creating Docker Secret"
263297
kubectl create secret docker-registry $IMAGE_PULL_SECRET_WEBLOGIC \
264-
--docker-server=index.docker.io/v1/ \
298+
--docker-server=${WL_DOCKER_SERVER}/ \
265299
--docker-username=$DOCKER_USERNAME \
266300
--docker-password=$DOCKER_PASSWORD \
267301
--docker-email=$DOCKER_EMAIL

src/integration-tests/kubernetes/command-job-template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ spec:
1111
activeDeadlineSeconds: 60
1212
containers:
1313
- name: domain-job
14-
image: store/oracle/weblogic:12.2.1.3
14+
image: container-registry.oracle.com/middleware/weblogic:12.2.1.3-190111
1515
imagePullPolicy: IfNotPresent
1616
volumeMounts:
1717
- mountPath: /scratch

0 commit comments

Comments
 (0)