fix: flush git mirror after gitops promote
This commit is contained in:
+4
-4
@@ -1090,8 +1090,8 @@ function nativeK8sStageFailure(
|
||||
};
|
||||
}
|
||||
|
||||
function runNativeGitMirrorStage(registry: BranchFollowerRegistry, follower: FollowerSpec, observedSha: string, action: "sync" | "flush", timeoutSeconds: number): { jobName: string; namespace: string; result: NativeK8sJobResult } | null {
|
||||
const job = nativeGitMirrorJobForFollower(follower, observedSha, action);
|
||||
function runNativeGitMirrorStage(registry: BranchFollowerRegistry, follower: FollowerSpec, observedSha: string, action: "sync" | "flush", timeoutSeconds: number, jobKey = observedSha): { jobName: string; namespace: string; result: NativeK8sJobResult } | null {
|
||||
const job = nativeGitMirrorJobForFollower(follower, jobKey, action);
|
||||
if (job === null) return null;
|
||||
const result = runNativeK8sJob(job.namespace, job.jobName, job.manifest, timeoutSeconds, action, registry.controller.budgets);
|
||||
return { jobName: job.jobName, namespace: job.namespace, result };
|
||||
@@ -1301,8 +1301,8 @@ async function waitNativeSentinelCloseout(
|
||||
latest = await readAdapterStatus(registry, follower, { ...options, timeoutSeconds: Math.min(10, remainingSeconds) });
|
||||
const latestPayload = asOptionalRecord(latest.payload);
|
||||
const latestGitMirror = asOptionalRecord(latestPayload?.gitMirror);
|
||||
if (latest.observedSha === observedSha && gitMirrorFlush === null && shouldFlushNativeGitMirrorDuringCloseout(follower, latestGitMirror)) {
|
||||
const flush = runNativeGitMirrorStage(registry, follower, observedSha, "flush", Math.min(remainingSeconds, follower.budgets.sourceSyncSeconds));
|
||||
if (latest.observedSha === observedSha && asOptionalRecord(latestPayload?.tekton)?.succeeded === true && gitMirrorFlush === null && shouldFlushNativeGitMirrorDuringCloseout(follower, latestGitMirror)) {
|
||||
const flush = runNativeGitMirrorStage(registry, follower, observedSha, "flush", Math.min(remainingSeconds, follower.budgets.sourceSyncSeconds), stringOrNull(latestGitMirror?.localGitops) ?? observedSha);
|
||||
gitMirrorFlush = flush === null ? null : {
|
||||
jobName: flush.jobName,
|
||||
namespace: flush.namespace,
|
||||
|
||||
Reference in New Issue
Block a user