MicrosoftPremier / VstsExtensions

Documentation and issue tracking for Microsoft Premier Services Visual Studio Team Services Extensions
MIT License
56 stars 14 forks source link

Build fails for PR update if Force Coverage Improvement #158

Closed yardstick17 closed 2 years ago

yardstick17 commented 2 years ago

Describe the context

Describe the problem and expected behavior I am intending to use Force Coverage Improvement to improve coverage over time. This coverage improvement is based on subsequent builds while I want the coverage improvement against a branch ( e.g., develop). If I use this feature enabled - the build works fine If I added new unit tests. In practice you update the PR addressing reviewers comment. Once you do that: coverage is compared against your last build, and if new units are not added in each update - pipeline will fail.

ReneSchumacher commented 2 years ago

Hi @yardstick17,

please look at the docs at https://github.com/MicrosoftPremier/VstsExtensions/blob/master/BuildQualityChecks/en-US/PullRequests.md#pull-request-policy. I believe they describe the scenario you would like to achieve.

The task needs a baseline build for the comparison and this can either be the latest successful build that ran for the same branch on which the task is currently running (e.g., you run a build as part of PR 21; BQC looks for the latest successful build that ran for branch refs/pull/21/merge) or the latest successful build for a specific branch. While the first option is the default, the second one can be configured by setting the baseBranchRef parameter to a fixed value (e.g., refs/heads/develop). For PR scenarios, it is useful to set baseBranchRef to the variable $(System.PullRequest.TargetBranch) to ensure that policies always compare with the latest merged in changes to the PR target branch. If you use the variable outside a PR, the task automatically falls back to the default behavior of comparing with a build for the current branch.

yardstick17 commented 2 years ago

Thanks @ReneSchumacher for your prompt reply. baseBranchRef is exactly what we wanted.