fix(platform-infra): gzip nginx secret transfer

This commit is contained in:
Codex
2026-07-13 14:33:14 +02:00
parent b1fa814f07
commit 876b87521a
+8 -4
View File
@@ -10,6 +10,7 @@ import {
} from "node:fs";
import { tmpdir } from "node:os";
import { isAbsolute, join } from "node:path";
import { gzipSync } from "node:zlib";
import type { UniDeskConfig } from "./config";
import { repoRoot, rootPath } from "./config";
import { startJob } from "./jobs";
@@ -467,6 +468,9 @@ cleanup_backends() {
systemctl daemon-reload >/dev/null 2>&1 || true
}
trap cleanup_backends EXIT
gzip -dc "$env_file.gz" > "$env_file"
chmod 0600 "$env_file"
rm -f "$env_file.gz"
curl -fsSL --retry 2 --connect-timeout 5 --max-time 120 \
${shQuote(artifactUrls.image)} -o "$image_artifact"
curl -fsSL --retry 2 --connect-timeout 5 --max-time 120 \
@@ -686,12 +690,12 @@ function uploadArtifact(route: string, localPath: string, remotePath: string): R
function uploadSecret(route: string, sourcePath: string, remotePath: string): Record<string, unknown> {
const directory = mkdtempSync(join(tmpdir(), "unidesk-nginx-secret-"));
const transferPath = join(directory, "runtime.bin");
const transferPath = join(directory, "runtime.env.gz");
try {
writeFileSync(transferPath, readFileSync(sourcePath));
writeFileSync(transferPath, gzipSync(readFileSync(sourcePath)));
chmodSync(transferPath, 0o600);
const result = uploadArtifact(route, transferPath, remotePath);
return { ...result, localPath: "binary-secret-transfer", valuesPrinted: false };
const result = uploadArtifact(route, transferPath, `${remotePath}.gz`);
return { ...result, localPath: "gzip-secret-transfer", valuesPrinted: false };
} finally {
rmSync(directory, { recursive: true, force: true });
}