fix: refresh sentinel argo application after publish (#907)

Co-authored-by: Codex <codex@noreply.local>
This commit is contained in:
Lyon
2026-06-26 00:06:56 +08:00
committed by GitHub
parent 049833b3b0
commit 058148903a
@@ -936,11 +936,14 @@ function applySentinelArgoApplication(state: SentinelCicdState, timeoutSeconds:
const app = state.manifests.find((item) => item.kind === "Application");
if (app === undefined) return { ok: false, reason: "application-manifest-missing", valuesRedacted: true };
const yaml = `${Bun.YAML.stringify(app).trim()}\n`;
const namespace = stringAt(state.cicd, "argo.namespace");
const applicationName = stringAt(state.cicd, "argo.applicationName");
const script = [
"set -eu",
"tmp=$(mktemp)",
`cat >"$tmp" <<'YAML'\n${yaml}YAML`,
"kubectl apply -f \"$tmp\"",
`kubectl -n ${shellQuote(namespace)} annotate application ${shellQuote(applicationName)} argocd.argoproj.io/refresh=hard --overwrite`,
].join("\n");
const result = runCommand(["trans", stringAt(state.controlPlaneNode, "kubeRoute"), "sh", "--", script], repoRoot, { timeoutMs: Math.min(timeoutSeconds, 60) * 1000 });
return { ok: result.exitCode === 0, result: compactCommand(result), valuesRedacted: true };