fix: isolate v02 cicd source state
This commit is contained in:
@@ -3264,25 +3264,35 @@ git -C "$repo_path" fsck --connectivity-only --no-dangling >/tmp/hwlab-git-fsck.
|
||||
emit_timing fsck succeeded "$fsck_started_ms"
|
||||
git -C "$repo_path" update-server-info
|
||||
v02_head=$(git -C "$repo_path" rev-parse refs/heads/v0.2 2>/dev/null || true)
|
||||
v02_github_head=$(git -C "$repo_path" rev-parse refs/mirror-stage/heads/v0.2 2>/dev/null || true)
|
||||
g14_head=$(git -C "$repo_path" rev-parse refs/heads/G14 2>/dev/null || true)
|
||||
g14_github_head=$(git -C "$repo_path" rev-parse refs/mirror-stage/heads/G14 2>/dev/null || true)
|
||||
v02_gitops_head=$(git -C "$repo_path" rev-parse refs/heads/v0.2-gitops 2>/dev/null || true)
|
||||
v02_gitops_github_head=$(git -C "$repo_path" rev-parse refs/mirror-stage/heads/v0.2-gitops 2>/dev/null || true)
|
||||
published_at=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||
printf '%s\n' "$v02_head" | tee /cache/HWLAB-v0.2.head
|
||||
printf '%s\n' "$published_at" > /cache/HWLAB.last-sync
|
||||
export v02_head g14_head v02_gitops_head v02_gitops_github_head published_at
|
||||
export v02_head v02_github_head g14_head g14_github_head v02_gitops_head v02_gitops_github_head published_at
|
||||
node - <<'NODE' | tee /cache/HWLAB.last-sync.json
|
||||
const v02Head = process.env.v02_head || null;
|
||||
const v02GithubHead = process.env.v02_github_head || null;
|
||||
const gitopsHead = process.env.v02_gitops_head || null;
|
||||
const gitopsGithubHead = process.env.v02_gitops_github_head || null;
|
||||
const payload = {
|
||||
event: "git-mirror-sync",
|
||||
status: "published",
|
||||
repository: "pikasTech/HWLAB",
|
||||
publishedAt: process.env.published_at,
|
||||
pendingFlush: Boolean(process.env.v02_gitops_head && process.env.v02_gitops_github_head && process.env.v02_gitops_head !== process.env.v02_gitops_github_head),
|
||||
pendingFlush: Boolean(gitopsHead && gitopsGithubHead && gitopsHead !== gitopsGithubHead),
|
||||
sourceInSync: Boolean(v02Head && v02GithubHead && v02Head === v02GithubHead),
|
||||
gitopsInSync: Boolean(gitopsHead && gitopsGithubHead && gitopsHead === gitopsGithubHead),
|
||||
refs: {
|
||||
"refs/heads/v0.2": process.env.v02_head || null,
|
||||
"refs/heads/v0.2": v02Head,
|
||||
"refs/mirror-stage/heads/v0.2": v02GithubHead,
|
||||
"refs/heads/G14": process.env.g14_head || null,
|
||||
"refs/heads/v0.2-gitops": process.env.v02_gitops_head || null,
|
||||
"refs/mirror-stage/heads/v0.2-gitops": process.env.v02_gitops_github_head || null
|
||||
"refs/mirror-stage/heads/G14": process.env.g14_github_head || null,
|
||||
"refs/heads/v0.2-gitops": gitopsHead,
|
||||
"refs/mirror-stage/heads/v0.2-gitops": gitopsGithubHead
|
||||
}
|
||||
};
|
||||
console.log(JSON.stringify(payload));
|
||||
|
||||
Reference in New Issue
Block a user