Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .ibm/pipelines/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,7 @@ initiate_deployments() {
cd "${DIR}"
base_deployment
rbac_deployment
sleep 2h
}

# OSD-GCP specific deployment functions that merge diff files and skip orchestrator workflows
Expand Down Expand Up @@ -1301,12 +1302,14 @@ deploy_orchestrator_workflows() {
local pqsl_password_key="POSTGRES_PASSWORD"
local pqsl_svc_name="postgress-external-db-primary"
local patch_namespace="${NAME_SPACE_POSTGRES_DB}"
local release_name="${RELEASE_NAME_RBAC}"
else
local pqsl_secret_name="rhdh-postgresql-svcbind-postgres"
local pqsl_user_key="username"
local pqsl_password_key="password"
local pqsl_svc_name="rhdh-postgresql"
local patch_namespace="$namespace"
local release_name="${RELEASE_NAME}"
fi

oc apply -f "${WORKFLOW_MANIFESTS}"
Expand All @@ -1319,9 +1322,54 @@ deploy_orchestrator_workflows() {
sleep 5
done

echo "Updating user-onboarding secret with dynamic service URLs..."
# Update the user-onboarding secret with correct service URLs
local onboarding_server_url="http://user-onboarding-server.${namespace}:8080"

# Dynamically determine the backstage service (excluding psql)
local backstage_service
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)
if [[ -z "$backstage_service" ]]; then
echo "Warning: No backstage service found, using fallback"
backstage_service="backstage-rhdh"
fi
local backstage_notifications_url="http://${backstage_service}.${namespace}:80"

# Get the notifications bearer token from rhdh-secrets
local notifications_bearer_token
notifications_bearer_token=$(oc get secret "$release_name"-auth -n "$namespace" -o json | jq '.data."backend-secret"' -r | base64 -d)
if [[ -z "$notifications_bearer_token" ]]; then
echo "Warning: No BACKEND_SECRET found in rhdh-secrets, using empty token"
notifications_bearer_token=""
fi

# Base64 encode the URLs and token
local onboarding_server_url_b64
onboarding_server_url_b64=$(echo -n "$onboarding_server_url" | base64 -w 0)
local backstage_notifications_url_b64
backstage_notifications_url_b64=$(echo -n "$backstage_notifications_url" | base64 -w 0)
local notifications_bearer_token_b64
notifications_bearer_token_b64=$(echo -n "$notifications_bearer_token" | base64 -w 0)

# Patch the secret
oc patch secret user-onboarding-creds -n "$namespace" --type merge -p "{
\"data\": {
\"ONBOARDING_SERVER_URL\": \"$onboarding_server_url_b64\",
\"BACKSTAGE_NOTIFICATIONS_URL\": \"$backstage_notifications_url_b64\",
\"NOTIFICATIONS_BEARER_TOKEN\": \"$notifications_bearer_token_b64\"
}
}"
echo "User-onboarding secret updated successfully!"

for workflow in greeting user-onboarding; do
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\"}}}}}"
done

echo "Waiting for all workflow pods to be running..."
wait_for_deployment $namespace greeting 5
wait_for_deployment $namespace user-onboarding 5

echo "All workflow pods are now running!"
}

# Helper function to deploy workflows for orchestrator testing
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { test } from "@playwright/test";
import { UIhelper } from "../../../utils/ui-helper";
import { Common } from "../../../utils/common";
import { Orchestrator } from "../../../support/pages/orchestrator";

test.describe("Orchestrator user-onboarding workflow tests", () => {
let uiHelper: UIhelper;
let common: Common;
let orchestrator: Orchestrator;

test.beforeEach(async ({ page }) => {
uiHelper = new UIhelper(page);
common = new Common(page);
orchestrator = new Orchestrator(page);
await common.loginAsKeycloakUser();
});

test("User-onboarding workflow execution and workflow tab validation", async () => {
await uiHelper.openSidebar("Orchestrator");
await orchestrator.selectUserOnboardingWorkflowItem();
await orchestrator.runUserOnboardingWorkflow();
await uiHelper.openSidebar("Orchestrator");
});

test("User-onboarding workflow validate abort workflow", async () => {
await uiHelper.openSidebar("Orchestrator");
await orchestrator.selectUserOnboardingWorkflowItem();
await orchestrator.runUserOnboardingWorkflow();
await orchestrator.abortWorkflow();
});
});
29 changes: 29 additions & 0 deletions e2e-tests/playwright/support/pages/orchestrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,33 @@
async resetWorkflow() {
await this.page.getByRole("button", { name: "Reset" }).click();
}

async selectUserOnboardingWorkflowItem() {
const workflowHeader = this.page.getByRole("heading", {
name: "Workflows",
});
await expect(workflowHeader).toBeVisible();
await expect(workflowHeader).toHaveText("Workflows");
await expect(Workflows.workflowsTable(this.page)).toBeVisible();
await this.page.getByRole("link", { name: "User Onboarding" }).click();
}

async runUserOnboardingWorkflow(
userId = "user:default/guest",
iterationNo = "10",
nameOfUser = "rhdh-orchestrator-test-1",
recipients = ["user:default/guest"],
status = "Completed",

Check failure on line 237 in e2e-tests/playwright/support/pages/orchestrator.ts

View workflow job for this annotation

GitHub Actions / TSC, ESLint and Prettier

'status' is assigned a value but never used
) {
const runButton = this.page.getByRole("button", { name: "Run" });
await expect(runButton).toBeVisible();
await runButton.click();
await this.page.locator("#root_userId").fill(userId);
await this.page.locator("#root_iterationNum").fill(iterationNo);
await this.page.locator("#root_username").fill(nameOfUser);
await this.page.locator("#root_recipients_0").fill(recipients[0]);

await this.page.getByRole("button", { name: "Next" }).click();
await this.page.getByRole("button", { name: "Run" }).click();
}
}
Loading