From ae975789363d25eaad735dd28bd39cb376a17cdd Mon Sep 17 00:00:00 2001 From: Fortune-Ndlovu Date: Sun, 22 Jun 2025 23:19:50 +0100 Subject: [PATCH 1/4] fix: avoid double helm upgrade in CI install script Signed-off-by: Fortune-Ndlovu --- .rhdh/scripts/install.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.rhdh/scripts/install.sh b/.rhdh/scripts/install.sh index d5f4e561..abef3a0e 100755 --- a/.rhdh/scripts/install.sh +++ b/.rhdh/scripts/install.sh @@ -133,10 +133,7 @@ EOF rm -fr /tmp/"$CV"-unpacked fi -# 1. install (or upgrade) -helm upgrade redhat-developer-hub -i "${CHART_URL}" --version "$CV" - -# 2. collect values +# collect values PASSWORD=$(kubectl get secret redhat-developer-hub-postgresql -o jsonpath="{.data.password}" | base64 -d) if [[ $(oc auth can-i get route/openshift-console) == "yes" ]]; then CLUSTER_ROUTER_BASE=$(oc get route console -n openshift-console -o=jsonpath='{.spec.host}' | sed 's/^[^.]*\.//') @@ -148,7 +145,7 @@ elif [[ -z $CLUSTER_ROUTER_BASE ]]; then exit 1 fi -# 3. change values +# change values helm upgrade redhat-developer-hub -i "${CHART_URL}" --version "$CV" \ --set global.clusterRouterBase="${CLUSTER_ROUTER_BASE}" \ --set global.postgresql.auth.password="$PASSWORD" From 0c1670452f2760c44c9a344194a1c97bbe855993 Mon Sep 17 00:00:00 2001 From: Fortune-Ndlovu Date: Mon, 23 Jun 2025 18:18:27 +0100 Subject: [PATCH 2/4] handle secret not found Signed-off-by: Fortune-Ndlovu --- .rhdh/scripts/install.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.rhdh/scripts/install.sh b/.rhdh/scripts/install.sh index abef3a0e..5370e9b6 100755 --- a/.rhdh/scripts/install.sh +++ b/.rhdh/scripts/install.sh @@ -133,8 +133,16 @@ EOF rm -fr /tmp/"$CV"-unpacked fi -# collect values -PASSWORD=$(kubectl get secret redhat-developer-hub-postgresql -o jsonpath="{.data.password}" | base64 -d) +# collect values - check for existing secret in the target namespace +if kubectl get secret redhat-developer-hub-postgresql -n "$namespace" &> /dev/null; then + PASSWORD=$(kubectl get secret redhat-developer-hub-postgresql -n "$namespace" -o jsonpath="{.data.password}" | base64 -d) + echo "Found existing PostgreSQL secret in namespace $namespace, preserving password" +else + # Generate a new password for first-time installation + PASSWORD=$(openssl rand -base64 32 | tr -d "=+/" | cut -c1-25) + echo "No existing PostgreSQL secret found in namespace $namespace, generating new password" +fi + if [[ $(oc auth can-i get route/openshift-console) == "yes" ]]; then CLUSTER_ROUTER_BASE=$(oc get route console -n openshift-console -o=jsonpath='{.spec.host}' | sed 's/^[^.]*\.//') elif [[ -z $CLUSTER_ROUTER_BASE ]]; then From bf5399977eafd73adaf00e88a55b58ef42cfdc06 Mon Sep 17 00:00:00 2001 From: Fortune-Ndlovu Date: Wed, 25 Jun 2025 15:37:53 +0100 Subject: [PATCH 3/4] remove code block Signed-off-by: Fortune-Ndlovu --- .rhdh/scripts/install.sh | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.rhdh/scripts/install.sh b/.rhdh/scripts/install.sh index 5370e9b6..d1380c59 100755 --- a/.rhdh/scripts/install.sh +++ b/.rhdh/scripts/install.sh @@ -133,16 +133,6 @@ EOF rm -fr /tmp/"$CV"-unpacked fi -# collect values - check for existing secret in the target namespace -if kubectl get secret redhat-developer-hub-postgresql -n "$namespace" &> /dev/null; then - PASSWORD=$(kubectl get secret redhat-developer-hub-postgresql -n "$namespace" -o jsonpath="{.data.password}" | base64 -d) - echo "Found existing PostgreSQL secret in namespace $namespace, preserving password" -else - # Generate a new password for first-time installation - PASSWORD=$(openssl rand -base64 32 | tr -d "=+/" | cut -c1-25) - echo "No existing PostgreSQL secret found in namespace $namespace, generating new password" -fi - if [[ $(oc auth can-i get route/openshift-console) == "yes" ]]; then CLUSTER_ROUTER_BASE=$(oc get route console -n openshift-console -o=jsonpath='{.spec.host}' | sed 's/^[^.]*\.//') elif [[ -z $CLUSTER_ROUTER_BASE ]]; then From a0ee16f39b23c6d556fdeb7b668e4b7900d3b1bd Mon Sep 17 00:00:00 2001 From: Fortune-Ndlovu Date: Thu, 26 Jun 2025 10:52:09 +0100 Subject: [PATCH 4/4] update Signed-off-by: Fortune-Ndlovu --- .rhdh/scripts/install.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.rhdh/scripts/install.sh b/.rhdh/scripts/install.sh index d1380c59..0848be70 100755 --- a/.rhdh/scripts/install.sh +++ b/.rhdh/scripts/install.sh @@ -145,8 +145,7 @@ fi # change values helm upgrade redhat-developer-hub -i "${CHART_URL}" --version "$CV" \ - --set global.clusterRouterBase="${CLUSTER_ROUTER_BASE}" \ - --set global.postgresql.auth.password="$PASSWORD" + --set global.clusterRouterBase="${CLUSTER_ROUTER_BASE}" echo " While deploying you can watch at