feat: add manual G14 git mirror control

This commit is contained in:
Codex
2026-05-29 18:54:50 +00:00
parent 4c8926fd7f
commit 4326ffe2f5
4 changed files with 311 additions and 5 deletions
+12 -1
View File
@@ -1,9 +1,13 @@
import { hwlabG14MonitorStateFileName, parsePipelineTaskRunMetrics, rolloutRecordBody, semanticChangelogBullets } from "./src/hwlab-g14";
import { gitMirrorSyncJobManifest, hwlabG14MonitorStateFileName, parsePipelineTaskRunMetrics, rolloutRecordBody, semanticChangelogBullets } from "./src/hwlab-g14";
function assertCondition(condition: unknown, message: string, detail: unknown = {}): void {
if (!condition) throw new Error(`${message}: ${JSON.stringify(detail)}`);
}
function record(value: unknown): Record<string, unknown> {
return typeof value === "object" && value !== null && !Array.isArray(value) ? value as Record<string, unknown> : {};
}
assertCondition(
hwlabG14MonitorStateFileName({ once: false, dryRun: false }) === "latest-monitor-job.json",
"long-running monitor should own latest-monitor-job.json",
@@ -21,6 +25,12 @@ assertCondition(
"once dry-runs need a distinct pointer for low-noise diagnostics",
);
const gitMirrorJob = gitMirrorSyncJobManifest("git-mirror-hwlab-sync-manual-test");
assertCondition(gitMirrorJob.kind === "Job", "git mirror sync must be a manual Job, not a CronJob", gitMirrorJob);
assertCondition(record(gitMirrorJob.metadata).namespace === "devops-infra", "git mirror sync Job must target devops-infra", gitMirrorJob);
assertCondition(record(record(gitMirrorJob.metadata).labels)["hwlab.pikastech.local/trigger"] === "manual-cli", "git mirror sync Job must be labeled as manual CLI triggered", gitMirrorJob);
assertCondition(record(gitMirrorJob.spec).backoffLimit === 0, "git mirror sync Job should fail visibly instead of retrying in the background", gitMirrorJob);
const prBody = [
"## 背景",
"",
@@ -124,6 +134,7 @@ console.log(JSON.stringify({
"once jobs do not overwrite long-running monitor state",
"dry-run jobs do not overwrite live monitor state",
"once dry-run jobs have a distinct diagnostic state file",
"git mirror sync is a manual devops-infra Job, not a CronJob",
"rollout brief includes natural-language changelog before automatic diff summary",
"semantic changelog extracts Chinese summary sections",
"rollout brief includes lazy-build reused/rebuild metrics and service durations",