fix(ci): skip merge commits in hotfix cherry-pick provenance checker#39238
Open
sergioperezcheco wants to merge 1 commit into
Open
fix(ci): skip merge commits in hotfix cherry-pick provenance checker#39238sergioperezcheco wants to merge 1 commit into
sergioperezcheco wants to merge 1 commit into
Conversation
…anggenius#38996) The Hotfix Cherry-Pick Provenance workflow iterates every commit in the PR range via 'git rev-list --reverse', which includes merge commits. When a hotfix PR branch is synced with its base hotfix branch, the resulting merge commit has no cherry-pick provenance trailer (correctly, since it is not a cherry-pick), so the checker fails the PR even though every actual cherry-picked commit carries valid provenance. Pass --no-merges so only single-parent commits are validated. Merge commits cannot reasonably carry a '(cherry picked from commit <sha>)' trailer and are not the commits the provenance rule is meant to police.
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.
The Hotfix Cherry-Pick Provenance workflow iterates every commit in the PR range via 'git rev-list --reverse', which includes merge commits. When a hotfix PR branch is synced with its base hotfix branch, the resulting merge commit has no cherry-pick provenance trailer (correctly, since it is not a cherry-pick), so the checker fails the PR even though every actual cherry-picked commit carries valid provenance.
This adds --no-merges to the rev-list so only single-parent commits are validated. Merge commits cannot reasonably carry a '(cherry picked from commit )' trailer and are not the commits the provenance rule is meant to police. The reporter reproduced this on PR #38990 where four cherry-picked commits all had valid provenance but the job failed on the sync merge commit.
Verified locally against a reproduction repo: before the change 'git rev-list --reverse BASE..HEAD' returns 4 commits (including the merge), after the change it returns 3 (only the cherry-picks), and the script still correctly flags commits that genuinely lack a source trailer.
Fixes #38996