Skip to content

Commit

Permalink
Merge pull request #2770 from uselagoon/lagoon-internal-registry-secr…
Browse files Browse the repository at this point in the history
…et-overwrite-fix

create lagoon-internal-registry-secret only if does not exist yet
  • Loading branch information
Schnitzel authored Jul 20, 2021
2 parents 5dfb89d + 853181a commit fb6c5c0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion images/kubectl-build-deploy-dind/build-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ kubectl config use-context default/lagoon/kubernetes.default.svc

if [ ! -z ${INTERNAL_REGISTRY_URL} ] && [ ! -z ${INTERNAL_REGISTRY_USERNAME} ] && [ ! -z ${INTERNAL_REGISTRY_PASSWORD} ] ; then
echo "docker login -u '${INTERNAL_REGISTRY_USERNAME}' -p '${INTERNAL_REGISTRY_PASSWORD}' ${INTERNAL_REGISTRY_URL}" | /bin/bash
kubectl create secret docker-registry lagoon-internal-registry-secret --docker-server=${INTERNAL_REGISTRY_URL} --docker-username=${INTERNAL_REGISTRY_USERNAME} --docker-password=${INTERNAL_REGISTRY_PASSWORD} --dry-run -o yaml | kubectl apply -f -
# create lagoon-internal-registry-secret if it does not exist yet
if ! kubectl --insecure-skip-tls-verify -n ${NAMESPACE} get secret lagoon-internal-registry-secret &> /dev/null; then
kubectl create secret docker-registry lagoon-internal-registry-secret --docker-server=${INTERNAL_REGISTRY_URL} --docker-username=${INTERNAL_REGISTRY_USERNAME} --docker-password=${INTERNAL_REGISTRY_PASSWORD} --dry-run -o yaml | kubectl apply -f -
fi
REGISTRY_SECRETS+=("lagoon-internal-registry-secret")
REGISTRY=$INTERNAL_REGISTRY_URL # This will handle pointing Lagoon at the correct registry for non local builds
fi
Expand Down

0 comments on commit fb6c5c0

Please sign in to comment.