Skip to content

Commit 41bf831

Browse files
AndrienkoAleksandry-firstgustavolirasubhashkhileri
authored
feat(e2e): share orchestrator installation script (#60)
* feat(e2e): share orchestrator installation script Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com> Co-authored-by: Yona First <yfirst@redhat.com> Co-authored-by: Gustavo Lira e Silva <guga.java@gmail.com> * feat(e2e): remove workflow installation Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com> * Update scripts/install-orchestrator.sh Co-authored-by: Subhash Khileri <subhashkhileri2@gmail.com> * feat(e2e): fix typos Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com> * feat(e2e): remove namespace deletion Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com> * feat(e2e): use typescript wrapper Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com> * feat(e2e): bump package.json Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com> * feat(e2e): export installOrchestrator Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com> * feat(e2e): add docs Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com> --------- Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com> Co-authored-by: Yona First <yfirst@redhat.com> Co-authored-by: Gustavo Lira e Silva <guga.java@gmail.com> Co-authored-by: Subhash Khileri <subhashkhileri2@gmail.com>
1 parent c8fd863 commit 41bf831

8 files changed

Lines changed: 627 additions & 3 deletions

File tree

docs/.vitepress/config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ export default defineConfig({
102102
text: "Operator Deployment",
103103
link: "/guide/deployment/operator-deployment",
104104
},
105+
{
106+
text: "Orchestrator Deployment",
107+
link: "/guide/deployment/orchestrator-deployment",
108+
},
105109
{
106110
text: "Authentication Providers",
107111
link: "/guide/deployment/authentication",
@@ -203,6 +207,7 @@ export default defineConfig({
203207
},
204208
{ text: "KeycloakHelper", link: "/api/deployment/keycloak-helper" },
205209
{ text: "Keycloak Types", link: "/api/deployment/keycloak-types" },
210+
{ text: "installOrchestrator", link: "/api/deployment/orchestrator" },
206211
],
207212
},
208213
{
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# installOrchestrator
2+
3+
Runs the bundled orchestrator install script in the given OpenShift/Kubernetes namespace. The script ensures the namespace exists (reuses or creates), sets the current context, and deploys PostgreSQL, operator, and orchestrator workflows.
4+
5+
## Import
6+
7+
```typescript
8+
import installOrchestrator from "@red-hat-developer-hub/e2e-test-utils/orchestrator";
9+
```
10+
11+
Named import is also supported:
12+
13+
```typescript
14+
import { installOrchestrator } from "@red-hat-developer-hub/e2e-test-utils/orchestrator";
15+
```
16+
17+
## Function
18+
19+
### `installOrchestrator(namespace?)`
20+
21+
```typescript
22+
function installOrchestrator(namespace?: string): Promise<void>
23+
```
24+
25+
| Parameter | Type | Default | Description |
26+
| ----------- | -------- | --------------- | ------------------------------------ |
27+
| `namespace` | `string` | `"orchestrator"` | Target OpenShift/Kubernetes namespace |
28+
29+
**Returns:** `Promise<void>`Resolves when the script completes successfully; rejects on script failure or if not logged into a cluster.
30+
31+
## Example
32+
33+
```typescript
34+
import installOrchestrator from "@red-hat-developer-hub/e2e-test-utils/orchestrator";
35+
36+
await installOrchestrator(); // uses namespace "orchestrator"
37+
await installOrchestrator("my-e2e-orchestrator");
38+
```
39+
40+
## Requirements
41+
42+
- Cluster access: `oc` (or `kubectl`) in `PATH` and already logged in
43+
- The script runs in the same process (blocking until the shell script exits)
44+
45+
## Related Pages
46+
47+
- [Orchestrator Deployment (Guide)](/guide/deployment/orchestrator-deployment) - Usage patterns and prerequisites

docs/changelog.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## [1.1.18] - Current
5+
## [1.1.19] - Current
6+
7+
### Added
8+
9+
- **installOrchestrator(namespace?: string)**: Runs the orchestrator install script via a TypeScript wrapper; creates or reuses the given namespace (default `"orchestrator"`). Exported from `@red-hat-developer-hub/e2e-test-utils/orchestrator`.
10+
11+
## [1.1.18]
612

713
### Added
814

docs/guide/deployment/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,5 @@ Later configurations override earlier ones, allowing you to customize only what
166166
- [Keycloak Deployment](/guide/deployment/keycloak-deployment) - KeycloakHelper class
167167
- [Helm Deployment](/guide/deployment/helm-deployment) - Helm-specific guide
168168
- [Operator Deployment](/guide/deployment/operator-deployment) - Operator-specific guide
169+
- [Orchestrator Deployment](/guide/deployment/orchestrator-deployment) - installOrchestrator script
169170
- [Authentication](/guide/deployment/authentication) - Auth providers
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Orchestrator Deployment
2+
3+
The package provides a script-based installer for the orchestrator (workflows, PostgreSQL, and related resources) in an OpenShift/Kubernetes namespace. Use it when your E2E tests depend on a pre-installed orchestrator in the cluster.
4+
5+
## Overview
6+
7+
`installOrchestrator` runs a bundled shell script that:
8+
9+
1. Ensures the target namespace exists (reuses it if present, creates it if not)
10+
2. Sets the current `oc`/`kubectl` context to that namespace
11+
3. Deploys PostgreSQL, operator, and orchestrator workflows as defined by the script
12+
13+
The script is intended for use in global setup, `beforeAll`, or standalone tooling—not for per-test runs.
14+
15+
## Prerequisites
16+
17+
- OpenShift or Kubernetes cluster and `oc` (or `kubectl`) in `PATH`
18+
- You must be logged in: `oc login` (or equivalent)
19+
- The script expects `bash`
20+
21+
## Basic Usage
22+
23+
```typescript
24+
import installOrchestrator from "@red-hat-developer-hub/e2e-test-utils/orchestrator";
25+
26+
// Use default namespace "orchestrator"
27+
await installOrchestrator();
28+
29+
// Use a custom namespace
30+
await installOrchestrator("my-orchestrator-ns");
31+
```
32+
33+
## Usage in Tests
34+
35+
### Global setup
36+
37+
Run once before all tests:
38+
39+
```typescript
40+
// global-setup.ts
41+
import installOrchestrator from "@red-hat-developer-hub/e2e-test-utils/orchestrator";
42+
43+
export default async function globalSetup() {
44+
const namespace = process.env.ORCHESTRATOR_NAMESPACE ?? "orchestrator";
45+
await installOrchestrator(namespace);
46+
}
47+
```
48+
49+
### Before all tests in a file
50+
51+
```typescript
52+
import { test } from "@red-hat-developer-hub/e2e-test-utils/test";
53+
import installOrchestrator from "@red-hat-developer-hub/e2e-test-utils/orchestrator";
54+
55+
test.beforeAll(async () => {
56+
await installOrchestrator("orchestrator");
57+
});
58+
59+
test("uses orchestrator", async () => {
60+
// ...
61+
});
62+
```
63+
64+
## Namespace behavior
65+
66+
- If the namespace **does not exist**, it is created and the script continues with deployment.
67+
- If the namespace **already exists**, it is reused (not deleted or recreated). The script configures the context and proceeds with deployment steps that are idempotent where applicable.
68+
69+
This allows reusing the same namespace across runs or sharing it with other tooling.
70+
71+
## Related Pages
72+
73+
- [installOrchestrator API](/api/deployment/orchestrator) - Function signature and options
74+
- [Deployment Overview](/guide/deployment/) - Other deployment options (RHDH, Keycloak)

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@red-hat-developer-hub/e2e-test-utils",
3-
"version": "1.1.18",
3+
"version": "1.1.19",
44
"description": "Test utilities for RHDH E2E tests",
55
"license": "Apache-2.0",
66
"repository": {
@@ -48,6 +48,10 @@
4848
"./teardown": {
4949
"types": "./dist/playwright/teardown-namespaces.d.ts",
5050
"default": "./dist/playwright/teardown-namespaces.js"
51+
},
52+
"./orchestrator": {
53+
"types": "./dist/deployment/orchestrator/index.d.ts",
54+
"default": "./dist/deployment/orchestrator/index.js"
5155
}
5256
},
5357
"publishConfig": {
@@ -58,7 +62,7 @@
5862
"tsconfig.base.json"
5963
],
6064
"scripts": {
61-
"build": "yarn clean && tsc -p tsconfig.build.json && cp -r src/deployment/rhdh/config dist/deployment/rhdh/ && cp -r src/deployment/keycloak/config dist/deployment/keycloak/",
65+
"build": "yarn clean && tsc -p tsconfig.build.json && cp -r src/deployment/rhdh/config dist/deployment/rhdh/ && cp -r src/deployment/keycloak/config dist/deployment/keycloak/ && cp src/deployment/orchestrator/install-orchestrator.sh dist/deployment/orchestrator/",
6266
"prepare": "husky",
6367
"check": "yarn typecheck && yarn lint:check && yarn prettier:check",
6468
"clean": "rm -rf dist",
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { resolve } from "path";
2+
import { $ } from "../../utils/index.js";
3+
4+
const scriptPath = resolve(import.meta.dirname, "install-orchestrator.sh");
5+
6+
export async function installOrchestrator(namespace = "orchestrator") {
7+
await $`bash ${scriptPath} ${namespace}`;
8+
}
9+
10+
export default installOrchestrator;

0 commit comments

Comments
 (0)