Repository navigation
BUILD/CI: Scope format check to commits unique to the PR - #11667
yuanwu2017 wants to merge 4 commits into
Conversation
The commit-title, code-format and AUTHORS-file PR checks all compute their diff range from `$(git rev-parse HEAD^)`. Azure Pipelines builds PRs on top of a merge commit whose first parent is the target branch snapshot frozen at PR open time. On long-lived PRs, every `Merge branch <target>` commit merges in newer target-side commits that are reachable from HEAD but not from the frozen HEAD^, so those target-side commits (and their authors, titles, and formatting) leak into the check range and are wrongly attributed to the PR. Add an `azure_pr_base_sha` helper that fetches the current tip of the target branch (using SYSTEM_PULLREQUEST_TARGETBRANCH or defaulting to `master`) and returns the merge-base against HEAD. Use it as BASE_SOURCEVERSION in the three affected jobs. This scopes the checks to commits actually authored on the PR side. Signed-off-by: yuanwu <yuan.wu@intel.com>
|
@yuanwu2017 Heads-up: #11527 merged to master today and addresses the same root cause as this One gap remains: #11527 did not touch the Could you rebase on master and scope this PR to the |
Ok. |
…ange # Conflicts: # buildlib/pr/codestyle.yml
What?
Scope the
format(clang-format) PR check to the commits actually authoredon the PR side, instead of deriving its base from
git rev-parse HEAD^.Why?
buildlib/pr/codestyle.ymlcomputed the base of all three PR-only checks(
commit_title,format,author) from$(git rev-parse HEAD^). On along-lived PR, that first parent is the target-branch snapshot frozen at
PR-open time, so every
Merge branch mastercommit pulls in newer mastercommits that then show up as "PR side" and leak into the check.
#11527 fixed this for the
commit_titleandauthorjobs by using the twoparents of the Azure-generated merge commit
(
$(Build.SourceVersion)^1..$(Build.SourceVersion)^2). It did not touch theformatjob, which still usesgit rev-parse HEAD^and can therefore stillflag formatting from target-side commits on long-lived branches.
This PR closes that remaining gap. The originally proposed
azure_pr_base_shahelper and thecommit_title/authorhunks have beendropped, since #11527 already covers them.
How?
In the
formatjob, derive the range the same way #11527 does:Net diff against master is now a single file,
buildlib/pr/codestyle.yml,and all three PR checks agree on how the range is computed.