Repository navigation
ci: publish build provenance in the metrics payload (schema v4) - #4413
sombraSoft merged 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for build provenance (schema v4) in the metadata upload script. It adds a --provenanceFile argument, loads and validates the provenance JSON, and updates the payload construction and publishing functions to include this data. A review comment points out a potential crash (AttributeError) if the loaded JSON file is valid JSON but does not represent a dictionary, as data.get() would be called on a non-dictionary object and the error is not caught. Adding a type check for data is recommended to ensure a safe fallback to v3.
The payload identified a build by its ORFS superproject commit alone. Nightly pipelines repoint tools/OpenROAD away from the pinned submodule, so that commit does not describe what was built. Add --provenanceFile, carrying the jenkins-ci shared-library version and the submodule commits captured in the build workspace. It has to be produced there and passed in: the reporting workspace is a fresh submodule-pinned checkout, so reading the SHAs here would report the pinned commit for a build that used something else. Passed as a file rather than argv so the JSON never has to survive shell quoting. Emit v4 when both a job name and provenance are present, v3 when provenance is missing or malformed, v2 when there is no job name. The backend requires every v4 key, so a run that could not capture its submodules must stay on v3 rather than emit a message that will be rejected. Mirror provenance onto the oversized-payload v1 fallback as well — all its messages resolve to the same build and the backend upserts components by path, so omitting it would make an oversized nightly look like a build with no overrides. Also resolve a relative --provenanceFile against the caller's directory: the chdir to flow/ at import time would otherwise silently reinterpret it. Signed-off-by: Miguel Dalberto Pedro <miguel.pedro@precisioninno.com>
5f45b91 to
ef1d3a1
Compare
🔍 QoR checkMetrics reflect the PR merge build — i.e. what will land on the target branch. Advisory — results are log-only and do not affect build status. The authoritative QoR gate remains the local rules-file check. Commit 61 design(s) checked — 0 with regression(s), 0 without a comparable baseline.
|
Why
The metrics payload identified a build by its ORFS superproject commit alone. Nightly pipelines repoint
tools/OpenROADaway from the pinned submodule, so that commit does not describe what was built — and the metrics backend was attributing those submodule-HEAD results to a commit that pins something else.What
--provenanceFile: a JSON file carrying the jenkins-ci shared-library version and the submodule commits captured in the build workspace.{ "jenkins_library": { "ref": "or-v2.3.8", "sha": "…" }, "submodules": [ { "path": "tools/OpenROAD", "sha": "…", "pinned_sha": "…", "describe": "v2.0-20581-gaabdb99ea", "overridden": true } ] }It has to be produced in the build workspace and passed in, not computed here. This script runs from the reporting workspace, which is a fresh submodule-pinned checkout — reading the SHAs locally would report the pinned commit for a build that used something else, i.e. exactly backwards for every nightly.
Version selection
A run that could not capture its submodules stays on v3 rather than emitting a v4 message the backend will reject — the backend requires every v4 key, since an empty submodule list is indistinguishable from "capture failed" and would make a nightly look commit-representative.
A missing or unreadable provenance file warns and degrades to v3. Losing the whole metrics report over missing provenance is the worse outcome.
v1 fallback
Provenance is mirrored onto every message of the oversized-payload per-design fallback. They all resolve to the same build and the backend upserts components by path, so N copies converge on one set of rows. Omitting it would make an oversized nightly look like a build with no overrides.
Incidental fix
A relative
--provenanceFileis now resolved against the caller's directory. The module-levelos.chdirtoflow/would otherwise silently reinterpret any relative path passed on the command line — found while testing, since it made a correct invocation from the workspace root fail open to v3.Coordination
Backward-compatible on its own — without
--provenanceFilethe payload is byte-for-byte what it is today. jenkins-ci gates the flag by grepping this file for it, so either merge order is safe. Consumer must be deployed on v4 before v4 messages are produced, or they park as unsupported-schema.