Skip to content

Commit 5fd9a23

Browse files
committed
feat: fix for user-onboarding workflow for orchestrator testing
1 parent cdf3deb commit 5fd9a23

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.ibm/pipelines/utils.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,7 @@ base_deployment() {
771771
perform_helm_install "${RELEASE_NAME}" "${NAME_SPACE}" "${HELM_CHART_VALUE_FILE_NAME}"
772772

773773
deploy_orchestrator_workflows "${NAME_SPACE}"
774+
sleep 2h
774775
}
775776

776777
rbac_deployment() {
@@ -1141,6 +1142,45 @@ deploy_orchestrator_workflows() {
11411142
sleep 5
11421143
done
11431144

1145+
echo "Updating user-onboarding secret with dynamic service URLs..."
1146+
# Update the user-onboarding secret with correct service URLs
1147+
local onboarding_server_url="http://user-onboarding-server.${namespace}:8080"
1148+
1149+
# Dynamically determine the backstage service (excluding psql)
1150+
local backstage_service
1151+
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)
1152+
if [[ -z "$backstage_service" ]]; then
1153+
echo "Warning: No backstage service found, using fallback"
1154+
backstage_service="backstage-rhdh"
1155+
fi
1156+
local backstage_notifications_url="http://${backstage_service}.${namespace}:80"
1157+
1158+
# Get the notifications bearer token from rhdh-secrets
1159+
local notifications_bearer_token
1160+
notifications_bearer_token=$(oc get secret rhdh-secrets -n "$namespace" -o json | jq '.data.BACKEND_SECRET' -r | base64 -d)
1161+
if [[ -z "$notifications_bearer_token" ]]; then
1162+
echo "Warning: No BACKEND_SECRET found in rhdh-secrets, using empty token"
1163+
notifications_bearer_token=""
1164+
fi
1165+
1166+
# Base64 encode the URLs and token
1167+
local onboarding_server_url_b64
1168+
onboarding_server_url_b64=$(echo -n "$onboarding_server_url" | base64 -w 0)
1169+
local backstage_notifications_url_b64
1170+
backstage_notifications_url_b64=$(echo -n "$backstage_notifications_url" | base64 -w 0)
1171+
local notifications_bearer_token_b64
1172+
notifications_bearer_token_b64=$(echo -n "$notifications_bearer_token" | base64 -w 0)
1173+
1174+
# Patch the secret
1175+
oc patch secret user-onboarding-creds -n "$namespace" --type merge -p "{
1176+
\"data\": {
1177+
\"ONBOARDING_SERVER_URL\": \"$onboarding_server_url_b64\",
1178+
\"BACKSTAGE_NOTIFICATIONS_URL\": \"$backstage_notifications_url_b64\",
1179+
\"NOTIFICATIONS_BEARER_TOKEN\": \"$notifications_bearer_token_b64\"
1180+
}
1181+
}"
1182+
echo "User-onboarding secret updated successfully!"
1183+
11441184
for workflow in greeting user-onboarding; do
11451185
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\"}}}}}"
11461186
done

0 commit comments

Comments
 (0)