fix: restore jd01 sentinel follower status
This commit is contained in:
+24
-2
@@ -230,7 +230,7 @@ export function cicdHelp(): unknown {
|
||||
"bun scripts/cli.ts cicd branch-follower status --live",
|
||||
"bun scripts/cli.ts cicd branch-follower run-once --all --dry-run",
|
||||
"bun scripts/cli.ts cicd branch-follower run-once --follower hwlab-jd01-v03 --confirm --wait",
|
||||
"bun scripts/cli.ts cicd branch-follower events --follower agentrun-d601-v02",
|
||||
"bun scripts/cli.ts cicd branch-follower events --follower agentrun-jd01-v02",
|
||||
"bun scripts/cli.ts cicd branch-follower logs --follower web-probe-sentinel-master",
|
||||
],
|
||||
config: DEFAULT_CONFIG_PATH,
|
||||
@@ -869,7 +869,8 @@ async function readAdapterStatus(follower: FollowerSpec, options: ParsedOptions)
|
||||
"sourceCommit",
|
||||
"observedSha",
|
||||
"alignment.sourceCommit",
|
||||
], ["sourceCommit", "observedSha", "observedCommit", "selectedCommit", "selectedSourceCommit"]);
|
||||
], ["sourceCommit", "observedSha", "observedCommit", "selectedCommit", "selectedSourceCommit"])
|
||||
?? adapterObservedShaFromText(result.stdout, follower);
|
||||
const targetSha = firstStringPath(body, [
|
||||
"summary.targetCommit",
|
||||
"summary.targetSha",
|
||||
@@ -1367,6 +1368,27 @@ function firstStringByKey(root: unknown, keys: string[]): string | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
function adapterObservedShaFromText(stdout: string, follower: FollowerSpec): string | null {
|
||||
if (stdout.trim().length === 0) return null;
|
||||
const branch = escapeRegex(follower.source.branch);
|
||||
const sourceLine = new RegExp(`${escapeRegex(follower.source.repository)}@${branch}\\s+([0-9a-f]{12,40})`, "iu").exec(stdout);
|
||||
if (sourceLine !== null) return sourceLine[1];
|
||||
for (const pattern of [
|
||||
/"sourceCommit"\s*:\s*"([0-9a-f]{40})"/iu,
|
||||
/"commit"\s*:\s*"([0-9a-f]{40})"/iu,
|
||||
/sourceCommit['"]?\s*[:=]\s*['"]?([0-9a-f]{40})/iu,
|
||||
/\bcommit['"]?\s*[:=]\s*['"]?([0-9a-f]{40})/iu,
|
||||
]) {
|
||||
const match = pattern.exec(stdout);
|
||||
if (match !== null) return match[1];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function escapeRegex(value: string): string {
|
||||
return value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
|
||||
}
|
||||
|
||||
function recordAt(root: Record<string, unknown>, path: string[]): Record<string, unknown> | null {
|
||||
let current: unknown = root;
|
||||
for (const item of path) {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
// SPEC: PJ2026-01060508 Web哨兵 draft-2026-06-30-p14-sentinel-cicd-visibility.
|
||||
// SPEC: PJ2026-01060508 Web哨兵 draft-2026-07-01-p15-cadence-otel.
|
||||
// SPEC: PJ2026-01060508 Web哨兵 draft-2026-07-01-p16-cicd-source-snapshot.
|
||||
// SPEC: PJ2026-01060703 CI/CD branch follower draft-2026-07-03-p0-branch-follower.
|
||||
// Responsibility: YAML-first CI/CD, image, GitOps and Argo command plan for the web-probe sentinel.
|
||||
import { createHash, randomUUID } from "node:crypto";
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
@@ -27,7 +28,9 @@ import {
|
||||
arrayAt,
|
||||
arrayAtNullable,
|
||||
booleanAt,
|
||||
booleanAtNullable,
|
||||
compactCommand,
|
||||
configRefFile,
|
||||
displayPath,
|
||||
finiteNumberOrNull,
|
||||
isRecord,
|
||||
@@ -38,6 +41,7 @@ import {
|
||||
numberAtNullable,
|
||||
parseEnvFile,
|
||||
parseJsonObject,
|
||||
readConfigFile,
|
||||
record,
|
||||
recordTarget,
|
||||
rendered,
|
||||
@@ -48,8 +52,10 @@ import {
|
||||
renderPublishResult,
|
||||
resolveSentinelChildJson,
|
||||
safeJobSegment,
|
||||
safeKubernetesSegment,
|
||||
secretSourcePaths,
|
||||
sentinelCliSuffix,
|
||||
sentinelPipelineRunName,
|
||||
sentinelSourceSnapshotRef,
|
||||
sentinelSourceSnapshotStageRefPrefix,
|
||||
sha256,
|
||||
|
||||
Reference in New Issue
Block a user