From dfb3cfe22fb3d80dff0ae6dcd6ca18ff07c49f4a Mon Sep 17 00:00:00 2001 From: Codex Date: Mon, 29 Jun 2026 10:05:16 +0000 Subject: [PATCH] fix: route web-probe browsers path through YAML --- config/hwlab-node-lanes.yaml | 1 + scripts/src/hwlab-node-lanes.ts | 3 +++ scripts/src/hwlab-node/plan.ts | 1 + scripts/src/hwlab-node/web-observe-scripts.ts | 7 +++++-- scripts/src/hwlab-node/web-probe-observe.ts | 3 +++ 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/config/hwlab-node-lanes.yaml b/config/hwlab-node-lanes.yaml index 74327c45..5b9fc17a 100644 --- a/config/hwlab-node-lanes.yaml +++ b/config/hwlab-node-lanes.yaml @@ -890,6 +890,7 @@ lanes: queryRetryMaxDelayMs: 5000 webProbe: browserProxyMode: direct + playwrightBrowsersPath: "0" defaultOrigin: mode: public baseUrl: https://hwlab.pikapython.com diff --git a/scripts/src/hwlab-node-lanes.ts b/scripts/src/hwlab-node-lanes.ts index 9367006f..67c4f7b2 100644 --- a/scripts/src/hwlab-node-lanes.ts +++ b/scripts/src/hwlab-node-lanes.ts @@ -136,6 +136,7 @@ export type HwlabRuntimeWebProbeOriginSpec = HwlabRuntimeWebProbeServiceOriginSp export interface HwlabRuntimeWebProbeSpec { readonly browserProxyMode?: "auto" | "direct"; + readonly playwrightBrowsersPath?: string; readonly defaultOrigin?: HwlabRuntimeWebProbeOriginSpec; readonly authLogin?: HwlabRuntimeWebProbeAuthLoginSpec; readonly alertThresholds?: HwlabRuntimeWebProbeAlertThresholdsSpec; @@ -1014,8 +1015,10 @@ function webProbeConfig(value: unknown, path: string): HwlabRuntimeWebProbeSpec } browserProxyMode = rawBrowserProxyMode; } + const playwrightBrowsersPath = optionalStringField(raw, "playwrightBrowsersPath", path); return { ...(browserProxyMode === undefined ? {} : { browserProxyMode }), + ...(playwrightBrowsersPath === undefined ? {} : { playwrightBrowsersPath }), ...(raw.defaultOrigin === undefined ? {} : { defaultOrigin: webProbeOriginConfig(raw.defaultOrigin, `${path}.defaultOrigin`) }), ...(raw.authLogin === undefined ? {} : { authLogin: webProbeAuthLoginConfig(raw.authLogin, `${path}.authLogin`) }), ...(raw.alertThresholds === undefined ? {} : { alertThresholds: webProbeAlertThresholdsConfig(raw.alertThresholds, `${path}.alertThresholds`) }), diff --git a/scripts/src/hwlab-node/plan.ts b/scripts/src/hwlab-node/plan.ts index 26088bfa..caf4c411 100644 --- a/scripts/src/hwlab-node/plan.ts +++ b/scripts/src/hwlab-node/plan.ts @@ -133,6 +133,7 @@ export function nodeRuntimeExpected(spec: HwlabRuntimeLaneSpec): Record, ): Record { const webProbeProxy = nodeWebProbeHostProxyEnv(spec, options.browserProxyMode); - const script = nodeWebProbeScriptRemoteShell(options, secretSpec, material.username ?? secretSpec.bootstrapAdminUsername, material.password ?? "", webProbeProxy); + const script = nodeWebProbeScriptRemoteShell(options, secretSpec, material.username ?? secretSpec.bootstrapAdminUsername, material.password ?? "", webProbeProxy, spec.webProbe?.playwrightBrowsersPath); const result = runTransWorkspaceStdinScript(options.node, spec.workspace, script, options.commandTimeoutSeconds); const commandTimedOut = result.timedOut || result.exitCode === 124; const stdoutReport = parseJsonObject(result.stdout); @@ -606,7 +606,7 @@ function webProbeScriptPreferredCommands(options: NodeWebProbeScriptOptions): Re }; } -export function nodeWebProbeScriptRemoteShell(options: NodeWebProbeScriptOptions, secretSpec: RuntimeSecretSpec, username: string, password: string, webProbeProxy: NodeWebProbeHostProxyEnv): string { +export function nodeWebProbeScriptRemoteShell(options: NodeWebProbeScriptOptions, secretSpec: RuntimeSecretSpec, username: string, password: string, webProbeProxy: NodeWebProbeHostProxyEnv, playwrightBrowsersPath: string | undefined): string { const userScriptB64 = Buffer.from(options.scriptText, "utf8").toString("base64"); const runnerB64 = Buffer.from(nodeWebProbeScriptRunnerSource(), "utf8").toString("base64"); return [ @@ -624,6 +624,9 @@ export function nodeWebProbeScriptRemoteShell(options: NodeWebProbeScriptOptions `node -e "require('fs').writeFileSync(process.argv[1], Buffer.from(process.argv[2], 'base64'))" "$runner" ${shellQuote(runnerB64)}`, [ ...webProbeProxy.envAssignments, + ...(playwrightBrowsersPath === undefined ? [] : [ + `PLAYWRIGHT_BROWSERS_PATH=${shellQuote(playwrightBrowsersPath)}`, + ]), `HWLAB_WEB_BASE_URL=${shellQuote(options.url)}`, `HWLAB_WEB_USER=${shellQuote(username)}`, `HWLAB_WEB_PASS=${shellQuote(password)}`, diff --git a/scripts/src/hwlab-node/web-probe-observe.ts b/scripts/src/hwlab-node/web-probe-observe.ts index fab63d84..6ce69124 100644 --- a/scripts/src/hwlab-node/web-probe-observe.ts +++ b/scripts/src/hwlab-node/web-probe-observe.ts @@ -1313,6 +1313,9 @@ export function runNodeWebProbeObserveStart( const runnerEnvAssignments = [ ...webProbeProxy.envAssignments, ...webProbeAccountEnvAssignments(), + ...(spec.webProbe?.playwrightBrowsersPath === undefined ? [] : [ + `PLAYWRIGHT_BROWSERS_PATH=${shellQuote(spec.webProbe.playwrightBrowsersPath)}`, + ]), `HWLAB_WEB_BASE_URL=${shellQuote(options.url)}`, `HWLAB_WEB_USER=${shellQuote(material.username ?? secretSpec.bootstrapAdminUsername)}`, `HWLAB_WEB_PASS=${shellQuote(material.password)}`,