From e69d0683d41b66c0e7fd527e947e0a07620cf8fa Mon Sep 17 00:00:00 2001 From: Marian Ganisin Date: Fri, 21 Oct 2022 13:26:56 +0000 Subject: [PATCH] Create pull-secret if provided Let the run.sh create the tools namespace and necessary pull-secret if content for pull-secret is provided. The content is docker config referenced via DOCKERCONFIGJSON env variable. DOCKERCONFIGJSON is intentionally different from DOCKER_CONFIG used to provide alternate config location and the name is inspired by name of relevant openshift object. --- run.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/run.sh b/run.sh index cb71967..5461cde 100755 --- a/run.sh +++ b/run.sh @@ -3,7 +3,17 @@ cd `dirname $0` -oc apply -k overlays/testsuite/ --namespace "${SHARED_NAMESPACE:=tools}" +SHARED_NAMESPACE="${SHARED_NAMESPACE:=tools}" + +if [ -n "$DOCKERCONFIGJSON" ]; then + oc get project "$SHARED_NAMESPACE" || oc new-project "$SHARED_NAMESPACE" --skip-config-write=true + _oc="oc -n $SHARED_NAMESPACE" + $_oc get secret pull-secret \ + || ( $_oc create secret generic pull-secret --from-file .dockerconfigjson="$DOCKERCONFIGJSON" --type=kubernetes.io/dockerconfigjson \ + && $_oc secrets link default pull-secret --for=pull ) +fi + +oc apply -k overlays/testsuite/ --namespace "${SHARED_NAMESPACE}" NAMESPACE=$SHARED_NAMESPACE ./base/rhsso/deploy-rhsso.sh