fix: parse full sentinel dashboard probe output
This commit is contained in:
@@ -2094,6 +2094,7 @@ function probeSentinelDashboardBrowser(state: SentinelCicdState, options: Extrac
|
||||
commandTimeoutMs: options.commandTimeoutSeconds * 1000,
|
||||
inactivityTimeoutMs: 30000,
|
||||
runIdPrefix: `web-probe-sentinel-dashboard-${state.spec.nodeId.toLowerCase()}-${state.spec.lane}-${state.sentinelId}`,
|
||||
stdoutTailBytes: 32768,
|
||||
}, script);
|
||||
const result = job.result;
|
||||
const transport = record(job.transport);
|
||||
|
||||
@@ -12,6 +12,7 @@ export interface WebProbeRemoteArtifactJobOptions {
|
||||
pollIntervalMs?: number;
|
||||
keepRemote?: boolean;
|
||||
runIdPrefix?: string;
|
||||
stdoutTailBytes?: number;
|
||||
}
|
||||
|
||||
interface RemoteWebProbeArtifactManifest {
|
||||
@@ -44,11 +45,12 @@ export function runWebProbeRemoteArtifactJob(options: WebProbeRemoteArtifactJobO
|
||||
const localDir = resolve(options.localDir);
|
||||
const commandTimeoutMs = Math.max(1_000, options.commandTimeoutMs);
|
||||
const pollIntervalMs = Math.max(250, options.pollIntervalMs ?? 2_000);
|
||||
const stdoutTailBytes = Math.max(4_000, Math.min(256_000, Math.floor(options.stdoutTailBytes ?? 4_000)));
|
||||
const inactivityTimeoutMs = options.inactivityTimeoutMs;
|
||||
const keepRemote = options.keepRemote === true;
|
||||
const submitCommand = [transPath(), options.route, "sh"];
|
||||
const submit = runCommand(submitCommand, repoRoot, {
|
||||
input: remoteArtifactSubmitScript(remoteDir, runId, userScript),
|
||||
input: remoteArtifactSubmitScript(remoteDir, runId, userScript, stdoutTailBytes),
|
||||
timeoutMs: Math.min(60_000, commandTimeoutMs),
|
||||
});
|
||||
const submitRecovery = submit.exitCode !== 0 && isRecoverableSubmitTimeout(submit)
|
||||
@@ -248,7 +250,7 @@ function cleanupRemoteDir(route: string, remoteDir: string, keepRemote: boolean)
|
||||
};
|
||||
}
|
||||
|
||||
function remoteArtifactSubmitScript(remoteDir: string, runId: string, userScript: string): string {
|
||||
function remoteArtifactSubmitScript(remoteDir: string, runId: string, userScript: string, stdoutTailBytes: number): string {
|
||||
return [
|
||||
"set -eu",
|
||||
`remote_dir=${shellQuote(remoteDir)}`,
|
||||
@@ -264,7 +266,7 @@ function remoteArtifactSubmitScript(remoteDir: string, runId: string, userScript
|
||||
"fi",
|
||||
writeBase64FileShell("$user_script", userScript, "UNIDESK_WEB_PROBE_ARTIFACT_USER_B64"),
|
||||
"chmod 700 \"$user_script\"",
|
||||
writeBase64FileShell("$runner_script", remoteArtifactRunnerScript(remoteDir, runId), "UNIDESK_WEB_PROBE_ARTIFACT_RUNNER_B64"),
|
||||
writeBase64FileShell("$runner_script", remoteArtifactRunnerScript(remoteDir, runId, stdoutTailBytes), "UNIDESK_WEB_PROBE_ARTIFACT_RUNNER_B64"),
|
||||
"chmod 700 \"$runner_script\"",
|
||||
'nohup sh "$runner_script" "$user_script" >"$submit_stdout" 2>"$submit_stderr" < /dev/null &',
|
||||
'pid=$!',
|
||||
@@ -297,7 +299,7 @@ function remoteArtifactStatusScript(remoteDir: string): string {
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
function remoteArtifactRunnerScript(remoteDir: string, runId: string): string {
|
||||
function remoteArtifactRunnerScript(remoteDir: string, runId: string, stdoutTailBytes: number): string {
|
||||
return [
|
||||
"set -eu",
|
||||
`remote_dir=${shellQuote(remoteDir)}`,
|
||||
@@ -328,7 +330,7 @@ function remoteArtifactRunnerScript(remoteDir: string, runId: string): string {
|
||||
" ;;",
|
||||
" esac",
|
||||
"done",
|
||||
"b64_tail() { if [ -f \"$1\" ]; then tail -c 4000 \"$1\" | base64 | tr -d '\\n'; fi; }",
|
||||
`b64_tail() { if [ -f "$1" ]; then tail -c ${stdoutTailBytes} "$1" | base64 | tr -d '\\n'; fi; }`,
|
||||
"{",
|
||||
`printf '%s\\n' ${shellQuote(manifestBegin)}`,
|
||||
"printf 'run_id\\t%s\\n' \"$run_id\"",
|
||||
|
||||
Reference in New Issue
Block a user