From 1432959c4e0b2ced74fe5100baee390765a61b9b Mon Sep 17 00:00:00 2001
From: Micah Nagel <micah.nagel@parsons.com>
Date: Tue, 21 Sep 2021 14:11:13 +0000
Subject: [PATCH] SKIP UPGRADE: Fix Keycloak in Master CI

---
 tests/ci/k3d/deploy_k3d.sh              | 2 +-
 tests/ci/k3d/metallb/install_metallb.sh | 2 +-
 tests/tests/01_virtualservices.sh       | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/ci/k3d/deploy_k3d.sh b/tests/ci/k3d/deploy_k3d.sh
index 77b3a8e179..0b436bfe92 100644
--- a/tests/ci/k3d/deploy_k3d.sh
+++ b/tests/ci/k3d/deploy_k3d.sh
@@ -2,7 +2,7 @@
 
 set -ex
 # if keycloak label or all packages label add deploy k3d without loadbalancer so metallb can be used
-if [[ $CI_MERGE_REQUEST_LABELS =~ "keycloak" ||  $CI_MERGE_REQUEST_LABELS =~ "all-packages" ]]; then
+if [[ "${CI_COMMIT_BRANCH}" == "${CI_DEFAULT_BRANCH}" ]] || [[ ! -z "$CI_COMMIT_TAG" ]] || [[ $CI_MERGE_REQUEST_LABELS =~ "keycloak" ||  $CI_MERGE_REQUEST_LABELS =~ "all-packages" ]]; then
   k3d cluster create ${CI_JOB_ID} --config tests/ci/k3d/disable-servicelb-config.yaml --network ${CI_JOB_ID}
 else
   k3d cluster create ${CI_JOB_ID} --config tests/ci/k3d/config.yaml --network ${CI_JOB_ID}
diff --git a/tests/ci/k3d/metallb/install_metallb.sh b/tests/ci/k3d/metallb/install_metallb.sh
index 150696b119..d60e34f550 100644
--- a/tests/ci/k3d/metallb/install_metallb.sh
+++ b/tests/ci/k3d/metallb/install_metallb.sh
@@ -2,7 +2,7 @@
 
 set -ex
 
-if [[ $CI_MERGE_REQUEST_LABELS =~ "keycloak" ||  $CI_MERGE_REQUEST_LABELS =~ "all-packages" ]]; then
+if [[ "${CI_COMMIT_BRANCH}" == "${CI_DEFAULT_BRANCH}" ]] || [[ ! -z "$CI_COMMIT_TAG" ]] || [[ $CI_MERGE_REQUEST_LABELS =~ "keycloak" ||  $CI_MERGE_REQUEST_LABELS =~ "all-packages" ]]; then
   kubectl create -f tests/ci/k3d/metallb/metallb.yaml
   kubectl create -f tests/ci/k3d/metallb/metallb-config.yaml
 else
diff --git a/tests/tests/01_virtualservices.sh b/tests/tests/01_virtualservices.sh
index 5da18892c3..c0d2004727 100755
--- a/tests/tests/01_virtualservices.sh
+++ b/tests/tests/01_virtualservices.sh
@@ -5,12 +5,12 @@ set -e
 
 # Populate /etc/hosts
 ip=$(kubectl -n istio-system get service public-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
-ip_passthrough=$(kubectl -n istio-system get service passthrough-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
 echo "Checking "
 
 hosts=`kubectl get virtualservices -A -o jsonpath="{ .items[*].spec.hosts[*] }"`
 for host in $hosts; do
   if [ $host == "keycloak.bigbang.dev" ]; then
+    ip_passthrough=$(kubectl -n istio-system get service passthrough-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
     echo "$ip_passthrough $host" >> /etc/hosts
   else
     echo "$ip $host" >> /etc/hosts
-- 
GitLab