@@ -919,6 +919,7 @@ initiate_deployments() {
919919 cd " ${DIR} "
920920 base_deployment
921921 rbac_deployment
922+ sleep 2h
922923}
923924
924925# OSD-GCP specific deployment functions that merge diff files and skip orchestrator workflows
@@ -1301,12 +1302,14 @@ deploy_orchestrator_workflows() {
13011302 local pqsl_password_key=" POSTGRES_PASSWORD"
13021303 local pqsl_svc_name=" postgress-external-db-primary"
13031304 local patch_namespace=" ${NAME_SPACE_POSTGRES_DB} "
1305+ local release_name=" ${RELEASE_NAME_RBAC} "
13041306 else
13051307 local pqsl_secret_name=" rhdh-postgresql-svcbind-postgres"
13061308 local pqsl_user_key=" username"
13071309 local pqsl_password_key=" password"
13081310 local pqsl_svc_name=" rhdh-postgresql"
13091311 local patch_namespace=" $namespace "
1312+ local release_name=" ${RELEASE_NAME} "
13101313 fi
13111314
13121315 oc apply -f " ${WORKFLOW_MANIFESTS} "
@@ -1319,9 +1322,54 @@ deploy_orchestrator_workflows() {
13191322 sleep 5
13201323 done
13211324
1325+ echo " Updating user-onboarding secret with dynamic service URLs..."
1326+ # Update the user-onboarding secret with correct service URLs
1327+ local onboarding_server_url=" http://user-onboarding-server.${namespace} :8080"
1328+
1329+ # Dynamically determine the backstage service (excluding psql)
1330+ local backstage_service
1331+ 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)
1332+ if [[ -z " $backstage_service " ]]; then
1333+ echo " Warning: No backstage service found, using fallback"
1334+ backstage_service=" backstage-rhdh"
1335+ fi
1336+ local backstage_notifications_url=" http://${backstage_service} .${namespace} :80"
1337+
1338+ # Get the notifications bearer token from rhdh-secrets
1339+ local notifications_bearer_token
1340+ notifications_bearer_token=$( oc get secret " $release_name " -auth -n " $namespace " -o json | jq ' .data."backend-secret"' -r | base64 -d)
1341+ if [[ -z " $notifications_bearer_token " ]]; then
1342+ echo " Warning: No BACKEND_SECRET found in rhdh-secrets, using empty token"
1343+ notifications_bearer_token=" "
1344+ fi
1345+
1346+ # Base64 encode the URLs and token
1347+ local onboarding_server_url_b64
1348+ onboarding_server_url_b64=$( echo -n " $onboarding_server_url " | base64 -w 0)
1349+ local backstage_notifications_url_b64
1350+ backstage_notifications_url_b64=$( echo -n " $backstage_notifications_url " | base64 -w 0)
1351+ local notifications_bearer_token_b64
1352+ notifications_bearer_token_b64=$( echo -n " $notifications_bearer_token " | base64 -w 0)
1353+
1354+ # Patch the secret
1355+ oc patch secret user-onboarding-creds -n " $namespace " --type merge -p " {
1356+ \" data\" : {
1357+ \" ONBOARDING_SERVER_URL\" : \" $onboarding_server_url_b64 \" ,
1358+ \" BACKSTAGE_NOTIFICATIONS_URL\" : \" $backstage_notifications_url_b64 \" ,
1359+ \" NOTIFICATIONS_BEARER_TOKEN\" : \" $notifications_bearer_token_b64 \"
1360+ }
1361+ }"
1362+ echo " User-onboarding secret updated successfully!"
1363+
13221364 for workflow in greeting user-onboarding; do
13231365 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 \" }}}}}"
13241366 done
1367+
1368+ echo " Waiting for all workflow pods to be running..."
1369+ wait_for_deployment $namespace greeting 5
1370+ wait_for_deployment $namespace user-onboarding 5
1371+
1372+ echo " All workflow pods are now running!"
13251373}
13261374
13271375# Helper function to deploy workflows for orchestrator testing
0 commit comments