Avoid republishing coverage artifacts on CI retries#14423
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 93490285-410f-4ddd-b27a-5f7a181ab58b
There was a problem hiding this comment.
Pull request overview
This PR updates the Azure Pipelines YAML to avoid attempting to republish fixed-name pipeline artifacts on job retries, addressing Azure Pipelines’ restriction that pipeline artifact names can’t be overwritten within the same build.
Changes:
- Gate Linux coverage artifact publishing to only occur on the first job attempt (
System.JobAttempt == 1). - Gate macOS coverage artifact publishing to only occur on the first job attempt (
System.JobAttempt == 1). - Add inline comments documenting the artifact immutability/retry rationale.
| # Pipeline artifact names are immutable within a build, so reuse the first attempt's artifact on job retries. | ||
| condition: and(eq(variables.onlyDocChanged, 0), eq(variables['System.JobAttempt'], 1)) |
| # Pipeline artifact names are immutable within a build, so reuse the first attempt's artifact on job retries. | ||
| condition: and(eq(variables.onlyDocChanged, 0), eq(variables['System.JobAttempt'], 1)) |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 93490285-410f-4ddd-b27a-5f7a181ab58b
There was a problem hiding this comment.
Review: LGTM ✅
Clean, well-scoped fix. System.JobAttempt is the correct Azure Pipelines variable for detecting retries (starts at 1 on first attempt). Both Linux and macOS sections are updated consistently.
Minor observation (non-blocking): If attempt 1 fails before producing merged.coverage, the artifact may not exist at all, so retries will not have coverage published. The downstream aggregation job would then fail to download it — but continueOnError: true on both the publish and (presumably) the download tasks means this degrades gracefully. The comment accurately describes the behavior.
No concerns with this change.
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
awmgmcpg
To allow these domains, add them to the
network.allowedlist in your workflow frontmatter:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
Generated by Expert Code Review (on open) for #14423 · 46.2 AIC · ⌖ 7.42 AIC · ⊞ 4.8K
Azure Pipelines does not allow a pipeline artifact name to be overwritten within the same build. Retrying the macOS job in build 1514663 therefore reported
Artifact MacCoreCoverage already exists.Publish Linux and macOS coverage under attempt-specific names. The aggregation job queries the build artifacts and downloads the highest attempt for each platform, so an individual leg can be retried without collisions or stale coverage.