Skip to content

Commit bbd6da6

Browse files
committed
Merge branch 'wkt-tests-34' into 'release/3.4'
Acceptance tests for 3.4 and new tenancy See merge request weblogic-cloud/weblogic-kubernetes-operator!4194
2 parents 2f32e69 + c847d03 commit bbd6da6

File tree

12 files changed

+466
-278
lines changed

12 files changed

+466
-278
lines changed

.github/workflows/publish-github-pages.yml

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2021, Oracle and/or its affiliates.
1+
# Copyright (c) 2021, 2023, Oracle and/or its affiliates.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33
#
44
# Description
@@ -8,9 +8,12 @@ name: "PublishGitHubPages"
88

99
on:
1010
push:
11-
branches: [ main ]
11+
branches:
12+
- main
13+
paths:
14+
- 'documentation/**'
1215
schedule:
13-
- cron: '15 3 * * 1'
16+
- cron: '15 3 * * *'
1417

1518
defaults:
1619
run:
@@ -23,34 +26,22 @@ jobs:
2326

2427
steps:
2528
- name: Checkout main
26-
uses: actions/checkout@v2.3.4
29+
uses: actions/checkout@v3
2730
with:
2831
ref: main
2932
fetch-depth: 32
3033
path: main
3134

3235
- name: Checkout gh-pages
33-
uses: actions/checkout@v2.3.4
36+
uses: actions/checkout@v3
3437
with:
3538
ref: gh-pages
3639
path: gh-pages
3740
token: ${{ secrets.PUBLISH_SECRET }}
3841

39-
- name: Verify changes to documentation present
40-
id: change-check
41-
run: |
42-
cd $GITHUB_WORKSPACE/main
43-
X=`git diff HEAD~1 --name-only | { grep "^documentation" || test $? = 1; } | wc -l`
44-
if [ $X == "0" ]; then
45-
echo 'No changes to the documenation'
46-
else
47-
echo '::set-output name=DOCUMENTATION_CHANGED::true'
48-
fi
49-
5042
- name: Build and publish site
51-
if: ${{ steps.change-check.outputs.DOCUMENTATION_CHANGED == 'true' }}
5243
run: |
53-
curl -fL -o hugo.tar.gz "https://github.com/gohugoio/hugo/releases/download/v0.82.0/hugo_0.82.0_Linux-64bit.tar.gz"
44+
curl -fL -o hugo.tar.gz "https://github.com/gohugoio/hugo/releases/download/v0.108.0/hugo_0.108.0_Linux-64bit.tar.gz"
5445
tar -xf hugo.tar.gz
5546
export PATH="$PWD:$PATH"
5647
mkdir $GITHUB_WORKSPACE/WORK

Jenkinsfile

Lines changed: 191 additions & 136 deletions
Large diffs are not rendered by default.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020, 2022, Oracle and/or its affiliates.
1+
// Copyright (c) 2020, 2023, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.weblogic.kubernetes;
@@ -211,7 +211,7 @@ void testIstioDomainHomeInPv() {
211211
// Use the WebLogic(12.2.1.4) Base Image with Japanese Locale
212212
String imageLocation = null;
213213
if (KIND_REPO != null) {
214-
imageLocation = KIND_REPO + "weblogick8s/test-images/weblogic:" + LOCALE_IMAGE_TAG;
214+
imageLocation = KIND_REPO + "test-images/weblogic:" + LOCALE_IMAGE_TAG;
215215
} else {
216216
imageLocation = LOCALE_IMAGE_NAME + ":" + LOCALE_IMAGE_TAG;
217217
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020, 2022, Oracle and/or its affiliates.
1+
// Copyright (c) 2020, 2023, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.weblogic.kubernetes;
@@ -22,6 +22,7 @@
2222
import oracle.weblogic.kubernetes.utils.ExecResult;
2323
import org.awaitility.core.ConditionFactory;
2424
import org.junit.jupiter.api.BeforeAll;
25+
import org.junit.jupiter.api.Disabled;
2526
import org.junit.jupiter.api.DisplayName;
2627
import org.junit.jupiter.api.MethodOrderer;
2728
import org.junit.jupiter.api.Order;
@@ -394,6 +395,7 @@ void testDomainLifecycleScripts() {
394395
@Order(7)
395396
@Test
396397
@DisplayName("Manage Traefik Ingress Controller with setupLoadBalancer")
398+
@Disabled("Needs to generate valid image")
397399
void testTraefikIngressController() {
398400
setupSample();
399401
Path scriptBase = get(tempSamplePath.toString(), "charts/util");
@@ -407,6 +409,7 @@ void testTraefikIngressController() {
407409
@Order(8)
408410
@Test
409411
@DisplayName("Manage Nginx Ingress Controller with setupLoadBalancer")
412+
@Disabled("Needs to generate valid image")
410413
void testNginxIngressController() {
411414
setupSample();
412415
Map<String, String> templateMap = new HashMap<>();

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

Lines changed: 127 additions & 76 deletions
Large diffs are not rendered by default.

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020, 2021, Oracle and/or its affiliates.
1+
// Copyright (c) 2020, 2023, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.weblogic.kubernetes.actions.impl;
@@ -11,8 +11,10 @@
1111

1212
import static oracle.weblogic.kubernetes.TestConstants.NGINX_INGRESS_IMAGE_DIGEST;
1313
import static oracle.weblogic.kubernetes.TestConstants.NGINX_INGRESS_IMAGE_TAG;
14-
import static oracle.weblogic.kubernetes.TestConstants.TEST_IMAGES_REPO_DEFAULT;
14+
import static oracle.weblogic.kubernetes.TestConstants.TEST_IMAGES_REPO;
15+
import static oracle.weblogic.kubernetes.TestConstants.TEST_IMAGES_TENANCY;
1516
import static oracle.weblogic.kubernetes.TestConstants.TEST_NGINX_IMAGE_NAME;
17+
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getDomainImagePrefix;
1618

1719
/**
1820
* All parameters needed to install NGINX ingress controller.
@@ -38,7 +40,7 @@ public class NginxParams {
3840
private boolean webhooksEnabled = false;
3941
private HelmParams helmParams;
4042
private String ingressClassName;
41-
private String imageRegistry = TEST_IMAGES_REPO_DEFAULT;
43+
private String imageRegistry = getDomainImagePrefix(TEST_IMAGES_REPO, TEST_IMAGES_TENANCY);
4244
private String nginxImage = TEST_NGINX_IMAGE_NAME;
4345
private String nginxImageTag = NGINX_INGRESS_IMAGE_TAG;
4446
private String nginxImageDigest = NGINX_INGRESS_IMAGE_DIGEST;

integration-tests/src/test/java/oracle/weblogic/kubernetes/extensions/ImageBuilders.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020, 2021, Oracle and/or its affiliates.
1+
// Copyright (c) 2020, 2023, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.weblogic.kubernetes.extensions;
@@ -40,6 +40,7 @@
4040
import static oracle.weblogic.kubernetes.TestConstants.BASE_IMAGES_REPO;
4141
import static oracle.weblogic.kubernetes.TestConstants.BASE_IMAGES_REPO_PASSWORD;
4242
import static oracle.weblogic.kubernetes.TestConstants.BASE_IMAGES_REPO_USERNAME;
43+
import static oracle.weblogic.kubernetes.TestConstants.BASE_IMAGES_TENANCY;
4344
import static oracle.weblogic.kubernetes.TestConstants.DB_IMAGE_NAME;
4445
import static oracle.weblogic.kubernetes.TestConstants.DB_IMAGE_TAG;
4546
import static oracle.weblogic.kubernetes.TestConstants.DOMAIN_IMAGES_REPO;
@@ -561,7 +562,8 @@ public Callable<Boolean> createBasicImage(String imageName, String imageTag, Str
561562

562563
private Callable<Boolean> pullImageFromOcrOrOcirAndPushToKind(String image) {
563564
return (() -> {
564-
String kindRepoImage = KIND_REPO + image.substring(BASE_IMAGES_REPO.length() + 1);
565+
String kindRepoImage = KIND_REPO
566+
+ image.substring(BASE_IMAGES_REPO.length() + BASE_IMAGES_TENANCY.length() + 2);
565567
return dockerPull(image) && dockerTag(image, kindRepoImage) && dockerPush(kindRepoImage);
566568
});
567569
}

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

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,24 @@ public static String getNonEmptySystemProperty(String propertyName, String defau
12581258
return propertyValue;
12591259
}
12601260

1261+
/**
1262+
* Get the named property from system environment or Java system property.
1263+
* If the property is defined in the Environment, that value will take precedence over
1264+
* Java properties.
1265+
*
1266+
* @param name the name of the environment variable, or Java property
1267+
* @param defaultValue if no environment variable is defined, nor system property, return this value
1268+
* @return the value defined in the env or system property
1269+
*/
1270+
public static String getEnvironmentProperty(String name, String defaultValue) {
1271+
String envValue = System.getenv(name);
1272+
if (envValue == null || envValue.isEmpty()) {
1273+
return getNonEmptySystemProperty(name, defaultValue);
1274+
} else {
1275+
return envValue;
1276+
}
1277+
}
1278+
12611279
/**
12621280
* Returns the Kind Repo value with a trailing slash.
12631281
*
@@ -1272,6 +1290,75 @@ public static String getKindRepoValue(String propertyName) {
12721290
return propertyValue;
12731291
}
12741292

1293+
/**
1294+
* Given a repo and tenancy name, determine the prefix length. For example,
1295+
* phx.ocir.io/foobar/test-images/myimage will treat phx.ocir.io/foobar/ as
1296+
* the prefix so the length is 19.
1297+
*
1298+
* @param baseRepo base repo name
1299+
* @param baseTenancy base tenancy name
1300+
* @return prefix length to strip when converting to internal repository name
1301+
*/
1302+
public static int getBaseImagesPrefixLength(String baseRepo, String baseTenancy) {
1303+
int result = 0;
1304+
1305+
if (baseRepo != null && baseRepo.length() > 0) {
1306+
// +1 for the trailing slash
1307+
result += baseRepo.length() + 1;
1308+
1309+
if (!baseRepo.equalsIgnoreCase("container-registry.oracle.com")) {
1310+
if (baseTenancy != null && baseTenancy.length() > 0) {
1311+
// +1 for the trailing slash
1312+
result += baseTenancy.length() + 1;
1313+
}
1314+
}
1315+
}
1316+
return result;
1317+
}
1318+
1319+
/**
1320+
* Returns the image name.
1321+
*
1322+
* @param kindRepo the kind repo value
1323+
* @param imageName the image name
1324+
* @param imageTag the image tag
1325+
* @param prefixLength the prefix length of the image name
1326+
* @return the image name and tag
1327+
*/
1328+
public static String getKindRepoImageForSpec(String kindRepo, String imageName, String imageTag, int prefixLength) {
1329+
String result = imageName + ":" + imageTag;
1330+
if (kindRepo != null && kindRepo.length() > 0) {
1331+
String imageNoPrefix = result.substring(prefixLength);
1332+
if (kindRepo.endsWith("/")) {
1333+
kindRepo = kindRepo.substring(0, kindRepo.length() - 1);
1334+
}
1335+
result = kindRepo + "/" + imageNoPrefix;
1336+
}
1337+
return result;
1338+
}
1339+
1340+
/**
1341+
* Another helper method to deal with the complexities of initializing test constants.
1342+
*
1343+
* @param repo the domain repo
1344+
* @param tenancy the test tenancy
1345+
* @return the domain prefix
1346+
*/
1347+
public static String getDomainImagePrefix(String repo, String tenancy) {
1348+
if (repo != null && repo.length() > 0) {
1349+
if (repo.endsWith("/")) {
1350+
repo = repo.substring(0, repo.length() - 1);
1351+
}
1352+
1353+
if (repo.endsWith(".com")) {
1354+
repo += "/";
1355+
} else {
1356+
repo += "/" + tenancy + "/";
1357+
}
1358+
}
1359+
return repo;
1360+
}
1361+
12751362
/**
12761363
* Get a unique name.
12771364
* @param prefix prefix of the name

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,6 @@ public static void dockerLoginAndPushImageToRegistry(String dockerImage) {
516516
// push image, if necessary
517517
getLogger().info("DOMAIN_IMAGES_REPO used for dockerLoginAndPushImageToRegistry is: {0}", DOMAIN_IMAGES_REPO);
518518
String repoPrefix = DOMAIN_IMAGES_REPO;
519-
if (DOMAIN_IMAGES_REPO.contains("weblogick8s")) {
520-
repoPrefix = DOMAIN_IMAGES_REPO.substring(0, DOMAIN_IMAGES_REPO.length() - 12);
521-
}
522519

523520
if (!DOMAIN_IMAGES_REPO.isEmpty() && dockerImage.contains(repoPrefix)) {
524521
logger.info("docker login to TEST_IMAGES_REPO {0}", TEST_IMAGES_REPO);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ public static void createDomainCrAndVerify(String adminSecretName,
679679
logger.info("Create model in image domain {0} in namespace {1} using docker image {2}",
680680
domainUid, namespace, miiImage);
681681
if (monexpConfig != null) {
682-
//String monexpImage = "phx.ocir.io/weblogick8s/exporter:beta";
682+
//String monexpImage = "phx.ocir.io/<tenancy>/exporter:beta";
683683
logger.info("yaml config file path : " + monexpConfig);
684684
String contents = null;
685685
try {

0 commit comments

Comments
 (0)