Skip to content

Commit 3caa747

Browse files
authored
Pass credentials to generate OCIR token (#2487)
* pass in credentials to delete images in ocir
1 parent 4c26b1d commit 3caa747

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -771,9 +771,6 @@ private static void createAndVerifyMiiDomain() {
771771
// get the pre-built image created by IntegrationTestWatcher
772772
miiImage = MII_BASIC_IMAGE_NAME + ":" + MII_BASIC_IMAGE_TAG;
773773

774-
// docker login and push image to docker registry if necessary
775-
dockerLoginAndPushImageToRegistry(miiImage);
776-
777774
// create docker registry secret to pull the image from registry
778775
// this secret is used only for non-kind cluster
779776
logger.info("Creating docker registry secret in namespace {0}", domainNamespace);

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ public void close() {
361361
if (DOMAIN_IMAGES_REPO.contains("ocir.io")) {
362362
String token = getOcirToken();
363363
if (token != null) {
364+
logger.info("Deleting these images from OCIR");
365+
logger.info(String.join(", ", pushedImages));
364366
for (String image : pushedImages) {
365367
deleteImageOcir(token, image);
366368
}
@@ -375,10 +377,14 @@ public void close() {
375377
private String getOcirToken() {
376378
LoggingFacade logger = getLogger();
377379
Path scriptPath = Paths.get(RESOURCE_DIR, "bash-scripts", "ocirtoken.sh");
378-
String cmd = scriptPath.toFile().getAbsolutePath();
380+
StringBuilder cmd = new StringBuilder()
381+
.append(scriptPath.toFile().getAbsolutePath())
382+
.append(" -u " + OCIR_USERNAME)
383+
.append(" -p \"" + OCIR_PASSWORD + "\"")
384+
.append(" -e " + OCIR_REGISTRY);
379385
ExecResult result = null;
380386
try {
381-
result = ExecCommand.exec(cmd, true);
387+
result = ExecCommand.exec(cmd.toString(), true);
382388
} catch (Exception e) {
383389
logger.info("Got exception while running command: {0}", cmd);
384390
logger.info(e.toString());

0 commit comments

Comments
 (0)