Skip to content

Avoid republishing coverage artifacts on CI retries#14423

Open
JanProvaznik wants to merge 2 commits into
dotnet:mainfrom
JanProvaznik:dev/janprovaznik/retry-safe-coverage-artifacts
Open

Avoid republishing coverage artifacts on CI retries#14423
JanProvaznik wants to merge 2 commits into
dotnet:mainfrom
JanProvaznik:dev/janprovaznik/retry-safe-coverage-artifacts

Conversation

@JanProvaznik

@JanProvaznik JanProvaznik commented Jul 17, 2026

Copy link
Copy Markdown
Member

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.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 93490285-410f-4ddd-b27a-5f7a181ab58b
Copilot AI review requested due to automatic review settings July 17, 2026 13:43
@JanProvaznik
JanProvaznik requested a review from a team as a code owner July 17, 2026 13:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .vsts-dotnet-ci.yml Outdated
Comment on lines +371 to +372
# 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))
Comment thread .vsts-dotnet-ci.yml Outdated
Comment on lines +461 to +462
# 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

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.allowed list 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

@JanProvaznik
JanProvaznik requested a review from AlesProkop July 17, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants