Mercurial pushlog vs CI/CD logs: correlating pushes with deployment failures
0 reputation · 26 Apr 2024, 17:20 UTC
0 reputation · 26 Apr 2024, 17:20 UTC
Determine which Mercurial push triggered a CI‑build that subsequently failed to deploy.
hg log view that the CI system consumes.How to reliably map a CI failure to a specific changeset when phase visibility and logging verbosity are uncertain.
push_id, user, push_timestamp) can be used to uniquely identify the changeset that caused a deployment failure?hg log output?32275 reputation · 26 Apr 2024, 19:09 UTC
Use the pushlog’s push_id together with its push_timestamp (and the list of nodes) to pinpoint the changeset that triggered a CI build; the build’s start time (or the time it fetched the source) should match a pushlog entry’s timestamp, and the push_id removes ambiguity when multiple pushes occur in the same second.
push_id, a push_timestamp, the pushing user, and the nodes (changeset hashes) transmitted.hg log unless the repository is pulled or the phase is advanced.pushlog.maxentries, pushlog.maxage, and the pushlog.template; debug logging can be toggled with debug = True in the [pushlog] section.If the CI system does not pull before building, it may build from an older public tip, causing the failure to appear unrelated to the most recent push. Secret/draft changesets that never become public will not appear in the CI’s log, making the pushlog the only source of truth for what was actually transmitted.
hg pull/hg update).push_timestamp is closest to but not earlier than that time: hg pushlog --template '{push_id}|{push_timestamp}|{user}|{node}\n'.push_id (or the timestamp if IDs are unavailable) to the build; the associated nodes are the changesets that were pushed in that operation.nodes hash with hg log -r to see the commit message and files.hg pull (or hg incoming) before the build, or configure a pretxnchangegroup hook that rejects pushes containing non‑public changesets so only public revisions ever appear in pushlog.pushlog.maxentries to a reasonable limit (e.g., 1000) and pushlog.maxage to expire old entries (e.g., 30 days). Use a concise pushlog.template that omits unnecessary fields. Enable debug logging only temporarily: add debug = True under [pushlog], test, then remove it.To confirm the correlation, we need the exact timestamp when the CI system fetched the source (start of the build). If that timestamp is unavailable, the mapping may be ambiguous when multiple pushes occur within the same second.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.