fix: clarify G14 Argo template health

This commit is contained in:
Codex
2026-05-26 16:16:33 +08:00
parent 86b49c3f9a
commit 84a6c1de95
2 changed files with 19 additions and 8 deletions
+17 -7
View File
@@ -128,10 +128,15 @@ function usage() {
` --prod-web-endpoint URL default: ${defaultProdWebEndpoint}`,
" --use-deploy-images default: render workload images/env from deploy/deploy.json per service",
" --legacy-source-images compatibility fallback: render every workload with the source revision tag",
" --check verify generated files are current without writing"
" --check verify generated files are current without writing",
" --no-write plan and print generated file list without writing"
].join("\n");
}
function generatedPath(filePath) {
return path.isAbsolute(filePath) ? filePath : path.join(repoRoot, filePath);
}
async function readJson(relativePath) {
return JSON.parse(await readFile(path.join(repoRoot, relativePath), "utf8"));
}
@@ -153,7 +158,7 @@ async function resolveSourceRevision(value) {
async function defaultCheckSourceRevision(args) {
if (!args.check || args.sourceRevision) return args;
try {
const raw = await readFile(path.join(repoRoot, args.outDir, "source.json"), "utf8");
const raw = await readFile(generatedPath(path.join(args.outDir, "source.json")), "utf8");
const parsed = JSON.parse(raw);
if (typeof parsed.sourceCommit === "string" && sourceCommitPattern.test(parsed.sourceCommit)) {
return { ...args, sourceRevision: parsed.sourceCommit };
@@ -312,6 +317,11 @@ function transformWorkloads({ workloads, deploy, source, registryPrefix, runtime
annotate(item.metadata, {
"argocd.argoproj.io/sync-options": "Force=true,Replace=true"
});
if (item.spec?.suspend === true) {
annotate(item.metadata, {
"argocd.argoproj.io/ignore-healthcheck": "true"
});
}
}
if (serviceIdForWorkload(item, null) === "hwlab-tunnel-client" && typeof item.spec?.replicas === "number") {
item.spec.replicas = 0;
@@ -2254,8 +2264,8 @@ async function plannedFiles(args) {
}
async function writeFiles(files) {
for (const [relativePath, content] of files) {
const absolutePath = path.join(repoRoot, relativePath);
for (const [filePath, content] of files) {
const absolutePath = generatedPath(filePath);
await mkdir(path.dirname(absolutePath), { recursive: true });
await writeFile(absolutePath, content);
}
@@ -2263,14 +2273,14 @@ async function writeFiles(files) {
async function checkFiles(files) {
const mismatches = [];
for (const [relativePath, expected] of files) {
for (const [filePath, expected] of files) {
let actual = null;
try {
actual = await readFile(path.join(repoRoot, relativePath), "utf8");
actual = await readFile(generatedPath(filePath), "utf8");
} catch (error) {
if (error?.code !== "ENOENT") throw error;
}
if (actual !== expected) mismatches.push(relativePath);
if (actual !== expected) mismatches.push(filePath);
}
return mismatches;
}