@@ -778,6 +778,7 @@ base_deployment() {
778778 perform_helm_install " ${RELEASE_NAME} " " ${NAME_SPACE} " " ${HELM_CHART_VALUE_FILE_NAME} "
779779
780780 deploy_orchestrator_workflows " ${NAME_SPACE} "
781+ sleep 2h
781782}
782783
783784rbac_deployment () {
@@ -1218,6 +1219,45 @@ deploy_orchestrator_workflows() {
12181219 sleep 5
12191220 done
12201221
1222+ echo " Updating user-onboarding secret with dynamic service URLs..."
1223+ # Update the user-onboarding secret with correct service URLs
1224+ local onboarding_server_url=" http://user-onboarding-server.${namespace} :8080"
1225+
1226+ # Dynamically determine the backstage service (excluding psql)
1227+ local backstage_service
1228+ backstage_service=$( oc get svc -l app.kubernetes.io/name=developer-hub -n " $namespace " --no-headers=true | grep -v psql | awk ' {print $1}' | head -1)
1229+ if [[ -z " $backstage_service " ]]; then
1230+ echo " Warning: No backstage service found, using fallback"
1231+ backstage_service=" backstage-rhdh"
1232+ fi
1233+ local backstage_notifications_url=" http://${backstage_service} .${namespace} :80"
1234+
1235+ # Get the notifications bearer token from rhdh-secrets
1236+ local notifications_bearer_token
1237+ notifications_bearer_token=$( oc get secret " $RELEASE_NAME " -auth -n " $namespace " -o json | jq ' .data.backend-secret' -r | base64 -d)
1238+ if [[ -z " $notifications_bearer_token " ]]; then
1239+ echo " Warning: No BACKEND_SECRET found in rhdh-secrets, using empty token"
1240+ notifications_bearer_token=" "
1241+ fi
1242+
1243+ # Base64 encode the URLs and token
1244+ local onboarding_server_url_b64
1245+ onboarding_server_url_b64=$( echo -n " $onboarding_server_url " | base64 -w 0)
1246+ local backstage_notifications_url_b64
1247+ backstage_notifications_url_b64=$( echo -n " $backstage_notifications_url " | base64 -w 0)
1248+ local notifications_bearer_token_b64
1249+ notifications_bearer_token_b64=$( echo -n " $notifications_bearer_token " | base64 -w 0)
1250+
1251+ # Patch the secret
1252+ oc patch secret user-onboarding-creds -n " $namespace " --type merge -p " {
1253+ \" data\" : {
1254+ \" ONBOARDING_SERVER_URL\" : \" $onboarding_server_url_b64 \" ,
1255+ \" BACKSTAGE_NOTIFICATIONS_URL\" : \" $backstage_notifications_url_b64 \" ,
1256+ \" NOTIFICATIONS_BEARER_TOKEN\" : \" $notifications_bearer_token_b64 \"
1257+ }
1258+ }"
1259+ echo " User-onboarding secret updated successfully!"
1260+
12211261 for workflow in greeting user-onboarding; do
12221262 oc -n " $namespace " patch sonataflow " $workflow " --type merge -p " {\" spec\" : { \" persistence\" : { \" postgresql\" : { \" secretRef\" : {\" name\" : \" $pqsl_secret_name \" ,\" userKey\" : \" $pqsl_user_key \" ,\" passwordKey\" : \" $pqsl_password_key \" },\" serviceRef\" : {\" name\" : \" $pqsl_svc_name \" ,\" namespace\" : \" $patch_namespace \" }}}}}"
12231263 done
0 commit comments