fix: stabilize ssh artifact downloads

This commit is contained in:
Codex
2026-06-02 09:13:11 +00:00
parent b6099492bc
commit 263b0cf3b2
4 changed files with 78 additions and 7 deletions
@@ -2,6 +2,10 @@ import { readFileSync } from "node:fs";
import { rootPath } from "./src/config";
const source = readFileSync(rootPath("scripts/src/artifact-registry.ts"), "utf8");
const downloadRemoteFileSource = source.slice(
source.indexOf("function downloadRemoteFile("),
source.indexOf("async function runRemoteScriptBackground("),
);
function assertCondition(condition: unknown, message: string): void {
if (!condition) throw new Error(message);
@@ -12,7 +16,7 @@ assertCondition(source.includes("downloadRemoteFile(options, remoteArchive, loca
assertCondition(source.includes("runRemoteScriptBackground(options, remoteScript"), "remote docker save must run as a background job");
assertCondition(source.includes('runRemoteScriptBackground(options, deployScript, Math.max(options.timeoutMs, 420_000), "d601-k3s-deploy")'), "D601 k3s deploy must use background polling");
assertCondition(source.includes('"ssh",\n options.providerId,\n "download"'), "download helper must route through UniDesk ssh download");
assertCondition(source.includes('"--chunk-bytes",\n "96000"'), "artifact ssh download must use the largest bounded chunk size");
assertCondition(!downloadRemoteFileSource.includes('"--chunk-bytes"'), "artifact ssh download must use the stable default bounded chunk size, not the largest chunk");
assertCondition(source.includes("UNIDESK_SSH_CLIENT_TOKEN") && source.includes("UNIDESK_SSH_CLIENT_ROUTE_ALLOWLIST"), "dev frontend artifact deploy must sync scoped ssh runtime keys");
console.log(JSON.stringify({
@@ -22,7 +26,7 @@ console.log(JSON.stringify({
"no docker-save stdout stream over ssh",
"compose artifact uses verified ssh download",
"remote docker save and k3s deploy use background polling",
"artifact downloads use the largest bounded ssh chunk size",
"artifact downloads use the stable default bounded ssh chunk size",
"dev frontend artifact deploy syncs scoped ssh runtime keys"
]
}, null, 2));