fix: route web-probe browsers path through YAML
This commit is contained in:
@@ -890,6 +890,7 @@ lanes:
|
||||
queryRetryMaxDelayMs: 5000
|
||||
webProbe:
|
||||
browserProxyMode: direct
|
||||
playwrightBrowsersPath: "0"
|
||||
defaultOrigin:
|
||||
mode: public
|
||||
baseUrl: https://hwlab.pikapython.com
|
||||
|
||||
@@ -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`) }),
|
||||
|
||||
@@ -133,6 +133,7 @@ export function nodeRuntimeExpected(spec: HwlabRuntimeLaneSpec): Record<string,
|
||||
},
|
||||
webProbe: spec.webProbe === undefined ? null : {
|
||||
browserProxyMode: spec.webProbe.browserProxyMode ?? null,
|
||||
playwrightBrowsersPath: spec.webProbe.playwrightBrowsersPath ?? null,
|
||||
defaultOrigin: spec.webProbe.defaultOrigin ?? null,
|
||||
},
|
||||
bootstrapAdmin: spec.bootstrapAdmin === undefined ? null : {
|
||||
|
||||
@@ -470,7 +470,7 @@ export function runNodeWebProbeScript(
|
||||
credential: Record<string, unknown>,
|
||||
): Record<string, unknown> {
|
||||
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)}`,
|
||||
|
||||
@@ -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)}`,
|
||||
|
||||
Reference in New Issue
Block a user