@red-hat-developer-hub/e2e-test-utils 1.1.41 → 1.1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/deployment/rhdh/config/operator/subscription.yaml +1 -1
- package/dist/deployment/rhdh/deployment.d.ts +1 -0
- package/dist/deployment/rhdh/deployment.d.ts.map +1 -1
- package/dist/deployment/rhdh/deployment.js +13 -37
- package/dist/deployment/rhdh/operator-setup.d.ts +2 -0
- package/dist/deployment/rhdh/operator-setup.d.ts.map +1 -0
- package/dist/deployment/rhdh/operator-setup.js +46 -0
- package/dist/playwright/global-setup.d.ts.map +1 -1
- package/dist/playwright/global-setup.js +2 -1
- package/package.json +1 -1
|
@@ -34,6 +34,7 @@ export declare class RHDHDeployment {
|
|
|
34
34
|
private _applyDynamicPlugins;
|
|
35
35
|
private _deployWithHelm;
|
|
36
36
|
private _deployWithOperator;
|
|
37
|
+
private get _labelSelector();
|
|
37
38
|
rolloutRestart(): Promise<void>;
|
|
38
39
|
/**
|
|
39
40
|
* Performs a clean restart by scaling down to 0 first, waiting for pods to terminate,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../../../src/deployment/rhdh/deployment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAwB1E,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAGjB,MAAM,YAAY,CAAC;AAEpB,qBAAa,cAAc;IAClB,SAAS,yBAAgC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,gBAAgB,CAAC;gBAE9B,SAAS,EAAE,MAAM;IAKvB,MAAM,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;YA0CpD,eAAe;YAmBf,aAAa;IA2B3B,uDAAuD;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sBAAsB;IA2CxB,SAAS,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAUrE,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,IAAI;IAIZ,OAAO,CAAC,SAAS;CAMlB"}
|
|
@@ -229,44 +229,20 @@ export class RHDHDeployment {
|
|
|
229
229
|
});
|
|
230
230
|
this._log(`Catalog index image: ${catalogIndexImage}`);
|
|
231
231
|
}
|
|
232
|
-
this._logBoxen("
|
|
232
|
+
this._logBoxen("Backstage CR", subscriptionObject);
|
|
233
233
|
const subscriptionFilePath = path.join(os.tmpdir(), `${this.deploymentConfig.namespace}-subscription.yaml`);
|
|
234
234
|
fs.writeFileSync(subscriptionFilePath, yaml.dump(subscriptionObject));
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
versionArg = `-v ${version}`;
|
|
243
|
-
}
|
|
244
|
-
else if (version === "next") {
|
|
245
|
-
versionArg = "--next";
|
|
246
|
-
}
|
|
247
|
-
else {
|
|
248
|
-
throw new Error(`Invalid RHDH version "${version}". Use semantic version (e.g., "1.5") or "next".`);
|
|
249
|
-
}
|
|
250
|
-
this._log(`Using operator branch: ${branch}, version arg: ${versionArg}`);
|
|
251
|
-
await $ `
|
|
252
|
-
set -e;
|
|
253
|
-
curl -sf https://raw.githubusercontent.com/redhat-developer/rhdh-operator/refs/heads/${branch}/.rhdh/scripts/install-rhdh-catalog-source.sh | bash -s -- ${versionArg} --install-operator rhdh
|
|
254
|
-
|
|
255
|
-
timeout 300 bash -c '
|
|
256
|
-
while ! oc get crd/backstages.rhdh.redhat.com -n "${this.deploymentConfig.namespace}" >/dev/null 2>&1; do
|
|
257
|
-
echo "Waiting for Backstage CRD to be created..."
|
|
258
|
-
sleep 20
|
|
259
|
-
done
|
|
260
|
-
echo "Backstage CRD is created."
|
|
261
|
-
' || echo "Error: Timed out waiting for Backstage CRD creation."
|
|
262
|
-
|
|
263
|
-
oc apply -f "${subscriptionFilePath}" -n "${this.deploymentConfig.namespace}"
|
|
264
|
-
`;
|
|
265
|
-
this._log("Operator deployment executed successfully.");
|
|
235
|
+
await $ `oc apply -f "${subscriptionFilePath}" -n "${this.deploymentConfig.namespace}"`;
|
|
236
|
+
this._log("Backstage CR applied successfully.");
|
|
237
|
+
}
|
|
238
|
+
get _labelSelector() {
|
|
239
|
+
return this.deploymentConfig.method === "operator"
|
|
240
|
+
? "rhdh.redhat.com/app=backstage-developer-hub"
|
|
241
|
+
: "app.kubernetes.io/instance in (redhat-developer-hub,developer-hub)";
|
|
266
242
|
}
|
|
267
243
|
async rolloutRestart() {
|
|
268
244
|
this._log(`Restarting RHDH deployment in namespace ${this.deploymentConfig.namespace}...`);
|
|
269
|
-
await $ `oc rollout restart deployment -l '
|
|
245
|
+
await $ `oc rollout restart deployment -l '${this._labelSelector}' -n ${this.deploymentConfig.namespace}`;
|
|
270
246
|
this._log(`RHDH deployment restarted successfully in namespace ${this.deploymentConfig.namespace}`);
|
|
271
247
|
await this.waitUntilReady();
|
|
272
248
|
}
|
|
@@ -277,13 +253,13 @@ export class RHDHDeployment {
|
|
|
277
253
|
*/
|
|
278
254
|
async scaleDownAndRestart() {
|
|
279
255
|
const namespace = this.deploymentConfig.namespace;
|
|
280
|
-
await $ `oc scale deployment -l '
|
|
281
|
-
await $ `oc wait --for=delete pod -l '
|
|
282
|
-
await $ `oc scale deployment -l '
|
|
256
|
+
await $ `oc scale deployment -l '${this._labelSelector}' --replicas=0 -n ${namespace}`;
|
|
257
|
+
await $ `oc wait --for=delete pod -l '${this._labelSelector}' -n ${namespace} --timeout=120s || true`;
|
|
258
|
+
await $ `oc scale deployment -l '${this._labelSelector}' --replicas=1 -n ${namespace}`;
|
|
283
259
|
}
|
|
284
260
|
async waitUntilReady(timeout = 500) {
|
|
285
261
|
const namespace = this.deploymentConfig.namespace;
|
|
286
|
-
const labelSelector =
|
|
262
|
+
const labelSelector = this._labelSelector;
|
|
287
263
|
const startTime = Date.now();
|
|
288
264
|
try {
|
|
289
265
|
await this.k8sClient.waitForPodsWithFailureDetection(namespace, labelSelector, timeout);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operator-setup.d.ts","sourceRoot":"","sources":["../../../src/deployment/rhdh/operator-setup.ts"],"names":[],"mappings":"AAEA,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CA0DzD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { $ } from "../../utils/bash.js";
|
|
2
|
+
export async function installRHDHOperator() {
|
|
3
|
+
if (process.env.INSTALLATION_METHOD !== "operator") {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
if (process.env.SKIP_OPERATOR_INSTALLATION === "true") {
|
|
7
|
+
console.log("Skipping RHDH operator installation");
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const version = process.env.RHDH_VERSION ?? "next";
|
|
11
|
+
const isSemanticVersion = /^\d+(\.\d+)?$/.test(version);
|
|
12
|
+
const branch = isSemanticVersion ? `release-${version}` : "main";
|
|
13
|
+
let versionArgs;
|
|
14
|
+
if (isSemanticVersion) {
|
|
15
|
+
versionArgs = ["-v", version];
|
|
16
|
+
}
|
|
17
|
+
else if (version === "next") {
|
|
18
|
+
versionArgs = ["--next"];
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
throw new Error(`Invalid RHDH version "${version}". Use semantic version (e.g., "1.5") or "next".`);
|
|
22
|
+
}
|
|
23
|
+
console.log(`Installing RHDH operator (branch: ${branch}, version: ${versionArgs.join(" ")})...`);
|
|
24
|
+
const scriptUrl = `https://raw.githubusercontent.com/redhat-developer/rhdh-operator/refs/heads/${branch}/.rhdh/scripts/install-rhdh-catalog-source.sh`;
|
|
25
|
+
try {
|
|
26
|
+
await $ `curl -sf ${scriptUrl} | bash -s -- ${versionArgs} --install-operator rhdh`;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
throw new Error(`install-rhdh-catalog-source.sh failed (branch: ${branch}, args: ${versionArgs.join(" ")} --install-operator rhdh).\nScript URL: ${scriptUrl}\n${error instanceof Error ? error.message : error}`, { cause: error });
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
await $ `
|
|
33
|
+
timeout 300 bash -c '
|
|
34
|
+
while ! oc get crd backstages.rhdh.redhat.com >/dev/null 2>&1; do
|
|
35
|
+
echo "Waiting for Backstage CRD to be created..."
|
|
36
|
+
sleep 10
|
|
37
|
+
done
|
|
38
|
+
echo "Backstage CRD is created."
|
|
39
|
+
'
|
|
40
|
+
`;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
throw new Error("Timed out waiting for Backstage CRD (backstages.rhdh.redhat.com) after 300s. The operator may not have installed correctly.", { cause: error });
|
|
44
|
+
}
|
|
45
|
+
console.log("RHDH operator installation completed");
|
|
46
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-setup.d.ts","sourceRoot":"","sources":["../../src/playwright/global-setup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"global-setup.d.ts","sourceRoot":"","sources":["../../src/playwright/global-setup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA8EnD,wBAA8B,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ3E"}
|
|
@@ -7,6 +7,7 @@ import { resolve } from "path";
|
|
|
7
7
|
import { KubernetesClientHelper } from "../utils/kubernetes-client.js";
|
|
8
8
|
import { $ } from "../utils/bash.js";
|
|
9
9
|
import { KeycloakHelper } from "../deployment/keycloak/index.js";
|
|
10
|
+
import { installRHDHOperator } from "../deployment/rhdh/operator-setup.js";
|
|
10
11
|
import { DEFAULT_KEYCLOAK_CONFIG, DEFAULT_RHDH_CLIENT, DEFAULT_USERS, } from "../deployment/keycloak/constants.js";
|
|
11
12
|
import { loadLocalVaultSecrets } from "../utils/vault.js";
|
|
12
13
|
const REQUIRED_BINARIES = ["oc", "kubectl", "helm"];
|
|
@@ -67,7 +68,7 @@ export default async function globalSetup(config) {
|
|
|
67
68
|
await loadLocalVaultSecrets();
|
|
68
69
|
loadDotenvFromProjects(config);
|
|
69
70
|
await setClusterRouterBaseEnv();
|
|
70
|
-
await deployKeycloak();
|
|
71
|
+
await Promise.all([installRHDHOperator(), deployKeycloak()]);
|
|
71
72
|
console.log("Global setup completed successfully");
|
|
72
73
|
}
|
|
73
74
|
/**
|