percona-obs: never promote on content-check service failure; compare rendered referenced macros - #13
Merged
Merged
Conversation
…rendered macros Two --branch-from decision fixes (PR #12 CI analysis, 2026-08-26): 1. _content_matches_branch caught SystemExit from a failed local service run and returned False ("content differs"), so a transient obs_scm clone error (curl 56 Connection reset by peer) promoted an unrelated, unchanged package. A failed run says nothing about the content: the services are now retried once (_run_services_for_check) and a second failure aborts the whole sync with the service's error. 2. _macros_changed_since compared inherited macros.yaml at file level (git diff --name-only <sha>..HEAD). Commit 146694c moved macros between staging/17/extras, staging/17 and staging/macros.yaml with identical rendered values, which flagged every ppg/staging package as "inherited macros changed" and sent ~120 of them through the service-running content check on every PR run. The check now compares the rendered values of the %!{NAME} macros the package actually references (obs/, debian/, rpm/ files) between the synced SHA (via git show) and the working tree. load_macros is split into _macros_chain_files + resolve_macros so both trees resolve through the same parser. Against the legacy production SHA 6440e48 this drops ppg/staging from 315/315 flagged packages to 4, all genuine version bumps (pg_tde x3, 19/haproxy). Tests: tests/test_content_check_retry.py, tests/test_macros_changed_since.py (real temporary git repo, no git mocking). Signed-off-by: Ricardo Dias <ricardo.dias@percona.com>
- Cancel queued Phase 1 decision futures when one raises, so a content check that fails twice surfaces immediately instead of after every remaining package has run its services. - Single "error:" prefix in the twice-failed content-check message. - Rename the _clean_sync_check reason to "referenced macros changed" and refresh the stale "inherited macros.yaml" wording (docstring, docs). - Document the _macros_changed_since precondition (package dir already verified unchanged by the caller). - Add a decision-layer test: _resolve_branch_decision raises on a double service failure and never returns a promote verdict. Signed-off-by: Ricardo Dias <ricardo.dias@percona.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two fixes to the
sync push --branch-fromdecision, found while analysing theOBS PR Checkfailure on PR #12 (run 32974781249): an unrelated, unchanged package (ppg:staging:17:extras/percona-postgresql) was promoted, then the upload phase failed for real on agit.postgresql.orgclone reset._content_matches_branchcaught theSystemExitfrom a failed local service run and returned "content differs". A failed run says nothing about the content, so it is now retried once and a second failure aborts the whole sync with the service's error (queued Phase 1 decisions are cancelled so the error surfaces immediately)._macros_changed_sincecompared inheritedmacros.yamlat file level (git diff --name-only <sha>..HEAD). Commit 146694c moved macros betweenstaging/17/extras,staging/17andstaging/macros.yamlwith identical rendered values, which flagged everyppg/stagingpackage as "inherited macros changed" against the (still valid, legacy-repo) production sync SHAs. The check now compares the rendered values of the%!{NAME}macros the package actually references between the synced SHA (git show) and the working tree, so moving a macro, or bumping one the package never uses, is not a change.Changes
percona_obs/cmd_sync.py—_run_services_for_check(retry once, thenSystemExit); Phase 1 executor cancels queued futures on error;_clean_sync_checkreason renamed toreferenced macros changed.percona_obs/git_utils.py—_macros_changed_sincerewritten:_referenced_macros(scan of UTF-8 files under the package dir minus theFILE_MODIFY_DATE*builtins),_commit_exists, memoised_git_show_at, comparison viaresolve_macros/load_macros. Signature unchanged, sosync_state.manifest_entry_clean(--skip-unchangedmanifest) gets the same fix.percona_obs/common.py—load_macrossplit into_macros_chain_files+resolve_macros(sources)so the historical tree resolves through the same parser..github/copilot-instructions.md(branch decision section, verbose-output table),docs/PERCONA_OBS_TOOL.md.Verification
pytest: 124 passed (11 new —tests/test_content_check_retry.pyincl. an end-to-end_resolve_branch_decisioncase;tests/test_macros_changed_since.pyon a real temporary git repo, no git mocking).black+pyrightclean.6440e48on real history: the old check flagged 315/315ppg/stagingpackages; the new check flags 4, all genuine version bumps since that SHA (percona-pg_tde×3,19/percona-haproxy).Notes
sync: main@… (rjd15372/percona-obs-packaging)revision comments (unneeded — the SHAs resolve and now compare clean), and the emptyobs_scmactions/cache on PR runners (CI workflow, separate).