fix: refresh argo during follower closeout

This commit is contained in:
Codex
2026-07-03 19:06:04 +00:00
parent 979bd33a72
commit 4d370bd0fb
2 changed files with 25 additions and 0 deletions
@@ -48,6 +48,8 @@ Follower-scoped commands such as `status --follower`, `events --follower`, `logs
Argo closeout visibility must include the bounded reason for non-ready health, not only `Synced/Progressing`: health message, operation phase/message, short Application conditions and a small list of non-healthy resources when available. Argo closeout visibility must include the bounded reason for non-ready health, not only `Synced/Progressing`: health message, operation phase/message, short Application conditions and a small list of non-healthy resources when available.
The automatic controller loop is non-blocking, so closeout acceleration cannot live only in the user-facing `--wait` path. Once a triggered PipelineRun has succeeded and required runtime/GitOps gates are not aligned, the in-cluster controller path should perform the same bounded target-side Argo refresh used by wait closeout; otherwise convergence depends on Argo's background poll interval and can exceed the 120s budget even when Tekton finished quickly.
Stage timing rows must not label optional gates as `not-ready` when they are not part of that follower's closeout contract. For sentinel-like followers without a GitOps branch flush gate, git-mirror source snapshot readiness should render as source-ready/ready, while missing GitOps `githubInSync` remains `-`/not-applicable instead of a failure-looking state. Stage timing rows must not label optional gates as `not-ready` when they are not part of that follower's closeout contract. For sentinel-like followers without a GitOps branch flush gate, git-mirror source snapshot readiness should render as source-ready/ready, while missing GitOps `githubInSync` remains `-`/not-applicable instead of a failure-looking state.
## Source Authority ## Source Authority
+23
View File
@@ -858,6 +858,10 @@ async function decideAndMaybeTrigger(
} }
if (options.dryRun && phase === "PendingTrigger") decision = `${decision}; dry-run did not trigger`; if (options.dryRun && phase === "PendingTrigger") decision = `${decision}; dry-run did not trigger`;
if (shouldRefreshAutomaticCloseout(follower, observedSha, live, phase, options)) {
const refresh = runNativeArgoRefresh(follower.nativeStatus.argo as NonNullable<NativeStatusSpec["argo"]>);
if (refresh.exitCode !== 0) warnings.push(`argo refresh failed: ${redactText(tailText(refresh.stderr || refresh.stdout, 300))}`);
}
const statePipelineRun = stringOrNull(triggerCommand?.pipelineRun) ?? live.pipelineRun; const statePipelineRun = stringOrNull(triggerCommand?.pipelineRun) ?? live.pipelineRun;
return { return {
@@ -904,6 +908,25 @@ async function decideAndMaybeTrigger(
}; };
} }
function shouldRefreshAutomaticCloseout(
follower: FollowerSpec,
observedSha: string | null,
live: AdapterSummary,
phase: BranchFollowerPhase,
options: ParsedOptions,
): boolean {
if (!options.inCluster || !options.confirm || options.wait || options.dryRun) return false;
if (phase !== "ClosingOut" || observedSha === null || follower.nativeStatus.argo === null) return false;
const payload = asOptionalRecord(live.payload);
const tekton = asOptionalRecord(payload?.tekton);
if (tekton?.succeeded !== true) return false;
const argo = asOptionalRecord(payload?.argo);
const runtime = asOptionalRecord(payload?.runtime);
const argoReady = argo?.ready === true;
const runtimeAligned = runtime?.aligned === true;
return !argoReady || !runtimeAligned || live.targetSha !== observedSha;
}
async function executeTrigger(registry: BranchFollowerRegistry, follower: FollowerSpec, observedSha: string | null, options: ParsedOptions): Promise<TriggerResult> { async function executeTrigger(registry: BranchFollowerRegistry, follower: FollowerSpec, observedSha: string | null, options: ParsedOptions): Promise<TriggerResult> {
const spec = follower.commands.trigger; const spec = follower.commands.trigger;
const timeoutSeconds = options.timeoutSeconds ?? spec.timeoutSeconds; const timeoutSeconds = options.timeoutSeconds ?? spec.timeoutSeconds;