Skip to content

Commit f7cc9c0

Browse files
committed
add secrets for docker-store
1 parent 689605b commit f7cc9c0

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

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

Lines changed: 34 additions & 1 deletion
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"
@@ -98,7 +127,9 @@ function pull_tag_images {
98127
exit 1
99128
fi
100129
# below docker pull is needed to get wlthint3client.jar from image to put in the classpath
130+
echo "docker login -u $OCR_USERNAME -p $OCR_PASSWORD ${WL_DOCKER_SERVER}"
101131
docker login -u $OCR_USERNAME -p $OCR_PASSWORD ${WL_DOCKER_SERVER}
132+
echo "docker pull $IMAGE_NAME_WEBLOGIC:$IMAGE_TAG_WEBLOGIC"
102133
docker pull $IMAGE_NAME_WEBLOGIC:$IMAGE_TAG_WEBLOGIC
103134
fi
104135
set -x
@@ -220,6 +251,8 @@ fi
220251
export JAR_VERSION="`grep -m1 "<version>" pom.xml | cut -f2 -d">" | cut -f1 -d "<"`"
221252

222253
echo IMAGE_NAME_OPERATOR $IMAGE_NAME_OPERATOR IMAGE_TAG_OPERATOR $IMAGE_TAG_OPERATOR JAR_VERSION $JAR_VERSION
254+
255+
docker_login
223256

224257
if [ "$SHARED_CLUSTER" = "true" ]; then
225258

0 commit comments

Comments
 (0)