Skip to content

Commit cfae327

Browse files
committed
Move generation of secrets
1 parent cd37103 commit cfae327

File tree

2 files changed

+32
-52
lines changed

2 files changed

+32
-52
lines changed

src/integration-tests/bash/run.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,35 @@ function create_image_pull_secret_jenkins {
566566

567567
}
568568

569+
function create_image_pull_secret_wercker {
570+
571+
trace "Creating Docker Secret"
572+
kubectl create secret docker-registry $IMAGE_PULL_SECRET_WEBLOGIC \
573+
--docker-server=index.docker.io/v1/ \
574+
--docker-username=$DOCKER_USERNAME \
575+
--docker-password=$DOCKER_PASSWORD \
576+
--docker-email=$DOCKER_EMAIL 2>&1 | sed 's/^/+' 2>&1
577+
578+
trace "Checking Secret"
579+
local SECRET="`kubectl get secret $IMAGE_PULL_SECRET_WEBLOGIC | grep $IMAGE_PULL_SECRET_WEBLOGIC | wc | awk ' { print $1; }'`"
580+
if [ "$SECRET" != "1" ]; then
581+
fail 'secret $IMAGE_PULL_SECRET_WEBLOGIC was not created successfully'
582+
fi
583+
584+
trace "Creating Registry Secret"
585+
kubectl create secret docker-registry $IMAGE_PULL_SECRET_OPERATOR \
586+
--docker-server=$REPO_REGISTRY \
587+
--docker-username=$REPO_USERNAME \
588+
--docker-password=$REPO_PASSWORD 2>&1 | sed 's/^/+' 2>&1
589+
590+
trace "Checking Secret"
591+
local SECRET="`kubectl get secret $IMAGE_PULL_SECRET_OPERATOR | grep $IMAGE_PULL_SECRET_OPERATOR | wc | awk ' { print $1; }'`"
592+
if [ "$SECRET" != "1" ]; then
593+
fail 'secret $IMAGE_PULL_SECRET_OPERATOR was not created successfully'
594+
fi
595+
596+
}
597+
569598
# op_define OP_KEY NAMESPACE TARGET_NAMESPACES EXTERNAL_REST_HTTPSPORT
570599
# sets up table of operator values.
571600
#
@@ -2577,6 +2606,8 @@ function test_suite_init {
25772606

25782607
mkdir -p $RESULT_ROOT/acceptance_test_tmp || fail "Could not mkdir -p RESULT_ROOT/acceptance_test_tmp (RESULT_ROOT=$RESULT_ROOT)"
25792608

2609+
create_image_pull_secret_wercker
2610+
25802611
elif [ "$JENKINS" = "true" ]; then
25812612

25822613
trace "Test Suite is running on Jenkins and k8s is running locally on the same node."

wercker.yml

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -163,71 +163,20 @@ integration-test:
163163
$WERCKER_SOURCE_DIR/src/integration-tests/bash/lease.sh -o "$LEASE_ID" -t $((100 * 60))
164164
echo @@
165165
166-
# create pull secrets
167-
echo @@ "Creating pull secrets"
168-
kubectl delete secret docker-store --ignore-not-found=true
169-
kubectl create secret docker-registry docker-store --docker-server=index.docker.io/v1/ --docker-username=$DOCKER_USERNAME --docker-password=$DOCKER_PASSWORD --docker-email=$DOCKER_EMAIL
170-
171166
export HOST_PATH="/scratch"
172167
export PV_ROOT=$HOST_PATH
173168
export RESULT_ROOT="$WERCKER_OUTPUT_DIR/k8s_dir"
174169
mkdir -m 777 -p $RESULT_ROOT
175170
export PROJECT_ROOT="${WERCKER_SOURCE_DIR}"
176171
$WERCKER_SOURCE_DIR/src/integration-tests/bash/cleanup.sh
177172
178-
# create pull secrets
179-
echo @@ "Creating pull secrets"
180-
kubectl delete secret docker-store --ignore-not-found=true
181-
kubectl create secret docker-registry docker-store --docker-server=index.docker.io/v1/ --docker-username=$DOCKER_USERNAME --docker-password=$DOCKER_PASSWORD --docker-email=$DOCKER_EMAIL
182-
183-
if [ `kubectl get ns test1 | grep Error | wc -l` = 0 ]; then
184-
kubectl delete ns test1 --ignore-not-found=true
185-
while [`kubectl get ns test1 -o jsonpath='{.status.phase}' | grep Terminating | wc -l` = 1 ]; do
186-
sleep 5
187-
done
188-
fi
189-
kubectl create ns test1
190-
if [ `kubectl get ns test2 | grep Error | wc -l` = 0 ]; then
191-
kubectl delete ns test2 --ignore-not-found=true
192-
while [`kubectl get ns test2 -o jsonpath='{.status.phase}' | grep Terminating | wc -l` = 1 ]; do
193-
sleep 5
194-
done
195-
fi
196-
kubectl create ns test2
197-
if [ `kubectl get ns weblogic-operator-1 | grep Error | wc -l` = 0 ]; then
198-
kubectl delete ns weblogic-operator-1 --ignore-not-found=true
199-
while [`kubectl get ns weblogic-operator-1 -o jsonpath='{.status.phase}' | grep Terminating | wc -l` = 1 ]; do
200-
sleep 5
201-
done
202-
fi
203-
kubectl create ns weblogic-operator-1
204-
if [ `kubectl get ns weblogic-operator-2 | grep Error | wc -l` = 0 ]; then
205-
kubectl delete ns weblogic-operator-2 --ignore-not-found=true
206-
while [`kubectl get ns weblogic-operator-2 -o jsonpath='{.status.phase}' | grep Terminating | wc -l` = 1 ]; do
207-
sleep 5
208-
done
209-
fi
210-
kubectl create ns weblogic-operator-2
211-
212-
kubectl delete secret docker-store -n test1 --ignore-not-found=true
213-
kubectl create secret docker-registry docker-store -n test1 --docker-server=index.docker.io/v1/ --docker-username=$DOCKER_USERNAME --docker-password=$DOCKER_PASSWORD --docker-email=$DOCKER_EMAIL
214-
215-
kubectl delete secret docker-store -n test2 --ignore-not-found=true
216-
kubectl create secret docker-registry docker-store -n test2 --docker-server=index.docker.io/v1/ --docker-username=$DOCKER_USERNAME --docker-password=$DOCKER_PASSWORD --docker-email=$DOCKER_EMAIL
217-
218-
kubectl delete secret test-registry -n weblogic-operator-1 --ignore-not-found=true
219-
kubectl create secret docker-registry test-registry -n weblogic-operator-1 --docker-server=$REPO_REGISTRY --docker-username=$REPO_USERNAME --docker-password=$REPO_PASSWORD
220-
221-
kubectl delete secret test-registry -n weblogic-operator-2 --ignore-not-found=true
222-
kubectl create secret docker-registry test-registry -n weblogic-operator-2 --docker-server=$REPO_REGISTRY --docker-username=$REPO_USERNAME --docker-password=$REPO_PASSWORD
223-
224173
export IMAGE_NAME_OPERATOR="${REPO_REPOSITORY}"
225174
export IMAGE_TAG_OPERATOR="${WERCKER_GIT_BRANCH//[_\/]/-}"
226175
if [ "$IMAGE_TAG_OPERATOR" = "master" ]; then
227176
export IMAGE_TAG_OPERATOR="latest"
228177
fi
229178
export IMAGE_PULL_POLICY_OPERATOR="Always"
230-
export IMAGE_PULL_SECRET_OPERATOR="test-registry"
179+
export IMAGE_PULL_SECRET_OPERATOR="ocir-registry"
231180
export IMAGE_PULL_SECRET_WEBLOGIC="docker-store"
232181
233182
echo "Integration test suite against the test image which is:"

0 commit comments

Comments
 (0)