@@ -636,8 +636,6 @@ public void deletePVCAndCheckPVReleased() throws Exception {
636
636
* @throws Exception
637
637
*/
638
638
public void createDomainOnExistingDirectory () throws Exception {
639
- String domainStoragePath = domainMap .get ("weblogicDomainStoragePath" ).toString ();
640
- String domainDir = domainStoragePath + "/domains/" + domainMap .get ("domainUID" ).toString ();
641
639
String cmd =
642
640
BaseTest .getProjectRoot ()
643
641
+ "/src/integration-tests/bash/krun.sh -m "
@@ -651,11 +649,7 @@ public void createDomainOnExistingDirectory() throws Exception {
651
649
+ "\" " ;
652
650
logger .info ("making sure the domain directory exists by running " + cmd );
653
651
ExecResult result = TestUtils .exec (cmd );
654
- logger .info ("Command result " + result .stdout () + " err =" + result .stderr ());
655
- /* if (domainDir != null && !(new File(domainDir).exists())) {
656
- throw new RuntimeException(
657
- "FAIL: the domain directory " + domainDir + " does not exist, exiting!");
658
- } */
652
+ // logger.info("Command result " + result.stdout() + " err =" + result.stderr());
659
653
logger .info ("Run the script to create domain" );
660
654
661
655
// create domain using different output dir but pv is same, it fails as the domain was already
@@ -1100,8 +1094,42 @@ protected void callCreateDomainScript(String outputDir) throws Exception {
1100
1094
String outputStr = result .stdout ().trim ();
1101
1095
logger .info ("Command returned " + outputStr );
1102
1096
1097
+ if (domainMap .containsKey ("domainHomeImageBase" ) && BaseTest .SHARED_CLUSTER ) {
1098
+ String dockerLoginAndPushCmd =
1099
+ "docker login "
1100
+ + System .getenv ("REPO_REGISTRY" )
1101
+ + " -u "
1102
+ + System .getenv ("REPO_USERNAME" )
1103
+ + " -p \" "
1104
+ + System .getenv ("REPO_PASSWORD" )
1105
+ + "\" && docker push "
1106
+ + System .getenv ("REPO_REGISTRY" )
1107
+ + "/weblogick8s/domain-home-in-image:"
1108
+ + (System .getenv ("IMAGE_TAG_WEBLOGIC" ) != null
1109
+ ? System .getenv ("IMAGE_TAG_WEBLOGIC" )
1110
+ : "12.2.1.3" );
1111
+ result = TestUtils .exec (dockerLoginAndPushCmd );
1112
+ logger .info (
1113
+ "cmd "
1114
+ + dockerLoginAndPushCmd
1115
+ + "\n result "
1116
+ + result .stdout ()
1117
+ + "\n err "
1118
+ + result .stderr ());
1119
+
1120
+ // create ocir registry secret in the same ns as domain which is used while pulling the domain
1121
+ // image
1122
+ TestUtils .createDockerRegistrySecret (
1123
+ "ocir-domain" ,
1124
+ System .getenv ("REPO_REGISTRY" ),
1125
+ System .getenv ("REPO_USERNAME" ),
1126
+ System .getenv ("REPO_PASSWORD" ),
1127
+ System .getenv ("REPO_EMAIL" ),
1128
+ domainNS );
1129
+ }
1130
+
1103
1131
// write configOverride and configOverrideSecrets to domain.yaml
1104
- if (domainMap .containsKey ("configOverrides" )) {
1132
+ if (domainMap .containsKey ("configOverrides" ) || domainMap . containsKey ( "domainHomeImageBase" ) ) {
1105
1133
appendToDomainYamlAndCreate ();
1106
1134
}
1107
1135
}
@@ -1368,6 +1396,11 @@ protected void initialize(Map<String, Object> inputDomainMap) throws Exception {
1368
1396
if (!domainMap .containsKey ("domainHomeImageBase" )) {
1369
1397
domainMap .put ("domainHome" , "/shared/domains/" + domainUid );
1370
1398
domainMap .put ("image" , imageName + ":" + imageTag );
1399
+ if (System .getenv ("IMAGE_PULL_SECRET_WEBLOGIC" ) != null ) {
1400
+ domainMap .put ("imagePullSecretName" , System .getenv ("IMAGE_PULL_SECRET_WEBLOGIC" ));
1401
+ } else {
1402
+ domainMap .put ("imagePullSecretName" , "docker-store" );
1403
+ }
1371
1404
}
1372
1405
1373
1406
if (domainMap .containsKey ("domainHomeImageBuildPath" )) {
@@ -1381,11 +1414,7 @@ protected void initialize(Map<String, Object> inputDomainMap) throws Exception {
1381
1414
+ "/"
1382
1415
+ ((String ) domainMap .get ("domainHomeImageBuildPath" )).trim ());
1383
1416
}
1384
- if (System .getenv ("IMAGE_PULL_SECRET_WEBLOGIC" ) != null ) {
1385
- domainMap .put ("imagePullSecretName" , System .getenv ("IMAGE_PULL_SECRET_WEBLOGIC" ));
1386
- } else {
1387
- domainMap .put ("imagePullSecretName" , "docker-store" );
1388
- }
1417
+
1389
1418
// remove null values if any attributes
1390
1419
domainMap .values ().removeIf (Objects ::isNull );
1391
1420
@@ -1474,20 +1503,24 @@ private void gitCloneDockerImagesSample() throws Exception {
1474
1503
* command
1475
1504
*/
1476
1505
private void appendToDomainYamlAndCreate () throws Exception {
1477
- String contentToAppend =
1478
- " configOverrides: "
1479
- + domainUid
1480
- + "-"
1481
- + domainMap .get ("configOverrides" )
1482
- + "\n "
1483
- + " configOverrideSecrets: [ \" "
1484
- + domainUid
1485
- + "-test-secrets\" ]"
1486
- + "\n " ;
1487
1506
1488
1507
String domainYaml =
1489
1508
BaseTest .getUserProjectsDir () + "/weblogic-domains/" + domainUid + "/domain.yaml" ;
1490
- Files .write (Paths .get (domainYaml ), contentToAppend .getBytes (), StandardOpenOption .APPEND );
1509
+
1510
+ if (domainMap .containsKey ("configOverrides" )) {
1511
+ String contentToAppend =
1512
+ " configOverrides: "
1513
+ + domainUid
1514
+ + "-"
1515
+ + domainMap .get ("configOverrides" )
1516
+ + "\n "
1517
+ + " configOverrideSecrets: [ \" "
1518
+ + domainUid
1519
+ + "-test-secrets\" ]"
1520
+ + "\n " ;
1521
+
1522
+ Files .write (Paths .get (domainYaml ), contentToAppend .getBytes (), StandardOpenOption .APPEND );
1523
+ }
1491
1524
1492
1525
String command = "kubectl create -f " + domainYaml ;
1493
1526
ExecResult result = TestUtils .exec (command );
@@ -1578,7 +1611,8 @@ private String prepareCmdToCallCreateDomainScript(String outputDir) {
1578
1611
createDomainScriptCmd .append (generatedInputYamlFile );
1579
1612
1580
1613
// skip executing yaml if configOverrides
1581
- if (!domainMap .containsKey ("configOverrides" )) {
1614
+ if (!domainMap .containsKey ("configOverrides" )
1615
+ && !domainMap .containsKey ("domainHomeImageBase" )) {
1582
1616
createDomainScriptCmd .append (" -e " );
1583
1617
}
1584
1618
0 commit comments