In Azure Repos, the main branch has a build validation policy with the trigger set to Automatic and the policy requirement set to Required. When main is updated, the team wants passing validation results to expire only if they are more than four hours old.
Which build policy setting should you configure?
Configure the conditional build expiration with a four-hour threshold. An update to main then invalidates a passing result when that result is older than the threshold. Immediate expiration also invalidates newer results, while Never leaves results valid after target branch updates regardless of age.
- Correct: Build expiration: After 4 hours if main has been updated. When main is updated, this setting expires a passing result if its age exceeds four hours. More recent passing results remain valid.
- Not correct: Policy requirement: Optional. Optional controls whether a failed build blocks PR completion. It does not configure the requested expiration threshold.
- Not correct: Build expiration: Immediately when main is updated. This setting invalidates the build result on every update to main, including when the passing result is less than four hours old.
- Not correct: Build expiration: Never. Updates to main would leave the existing policy status unchanged, even when the passing result is older than four hours.
- Set and manage branch policies - Azure ReposMicrosoft Learn