fix: report current gitea snapshot refs
Pipelines as Code CI / hwlab-web-probe-sentinel-jd01- Success

This commit is contained in:
Codex
2026-07-05 19:57:00 +00:00
parent c17954561e
commit c20227b2cf
+7 -4
View File
@@ -553,15 +553,18 @@ for repo in meta:
if len(parts) == 2:
refs[parts[1]] = parts[0]
branch_ref = f"refs/heads/{repo['branch']}"
branch_commit = refs.get(branch_ref)
snapshots = sorted((ref, sha) for ref, sha in refs.items() if ref.startswith(repo["snapshotPrefix"] + "/"))
latest_snapshot = snapshots[-1] if snapshots else None
matching_snapshots = [item for item in snapshots if branch_commit and item[1] == branch_commit]
latest_snapshot = matching_snapshots[-1] if matching_snapshots else (snapshots[-1] if snapshots else None)
current_snapshot_ready = bool(branch_commit and latest_snapshot and latest_snapshot[1] == branch_commit)
repos.append({
**repo,
"branchCommit": refs.get(branch_ref),
"branchCommit": branch_commit,
"snapshotRef": latest_snapshot[0] if latest_snapshot else None,
"snapshotCommit": latest_snapshot[1] if latest_snapshot else None,
"sourceBundleReady": bool(refs.get(branch_ref) and latest_snapshot),
"mirrorState": "ready" if refs.get(branch_ref) and latest_snapshot else "missing-ref",
"sourceBundleReady": current_snapshot_ready,
"mirrorState": "ready" if current_snapshot_ready else "missing-ref",
"errorTail": text(os.path.join(tmp, f"{repo['key']}.ls.err")),
})
payload = {"ok": status_rc == 0 and all(r["sourceBundleReady"] for r in repos), "repositories": repos, "valuesPrinted": False}