Skip to content

Append attempt number to build log artifact names - #55058

Merged
MichaelSimons merged 1 commit into
mainfrom
michaelsimons/fix-binlog-artifact-attempt-naming
Jun 29, 2026
Merged

MichaelSimons merged 1 commit into
mainfrom
michaelsimons/fix-binlog-artifact-attempt-naming

Conversation

@MichaelSimons

@MichaelSimons MichaelSimons commented Jun 29, 2026 •

Copy link
Copy Markdown
Member

Problem

When a build job is retried, the Publish Logs step in eng/pipelines/templates/jobs/sdk-build.yml publishes artifacts using the static name $(System.PhaseName)_Logs. Because the name does not change between attempts, a retry overwrites the binlogs from the previous (failed) attempt, making it impossible to diagnose what went wrong on the original run.

Fix

Append _Attempt$(System.JobAttempt) to the log artifact name so each attempt produces a uniquely named artifact -- for example, Build_windows_x64_Logs_Attempt1 and Build_windows_x64_Logs_Attempt2.

This mirrors the pattern already used in eng/common/core-templates/steps/publish-logs.yml for PostBuildLogs artifacts, which correctly includes _Attempt$(System.JobAttempt) in its artifact name.

Non-log artifacts (_Assets, _AotSizeAnalysis) are intentionally left unchanged -- overwriting those on retry is acceptable since later successful builds supersede earlier ones.

Change

- ArtifactName: $(System.PhaseName)_Logs
+ ArtifactName: $(System.PhaseName)_Logs_Attempt$(System.JobAttempt)

Note

This is especially valuable when investigating known flaky or broken builds where jobs are being retried -- whether manually or via auto-retry (e.g., build-configuration.json). Previously, the only binlogs available after a retry were from the final attempt, making it impossible to compare failure signatures across attempts or confirm whether a transient issue reproduced consistently. With this change, logs from every attempt are preserved and independently accessible in the pipeline artifacts.

Prevent binlogs from being overwritten on job retry by appending
_Attempt$(System.JobAttempt) to the Publish Logs artifact name,
matching the pattern already used for PostBuildLogs artifacts.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings June 29, 2026 19:48
@MichaelSimons
MichaelSimons requested a review from MiYanni as a code owner June 29, 2026 19:48
@MichaelSimons
MichaelSimons requested a review from a team June 29, 2026 19:49

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

Ensures build log artifacts aren’t overwritten when an Azure DevOps job is retried by making the published log artifact name attempt-specific.

Changes:

  • Update the “Publish Logs” artifact name to include $(System.JobAttempt) so each retry publishes a uniquely named log artifact (e.g., ..._Attempt1, ..._Attempt2).

@MichaelSimons
MichaelSimons requested review from a team and removed request for a team June 29, 2026 20:04
@MichaelSimons
MichaelSimons enabled auto-merge (squash) June 29, 2026 21:27
@MichaelSimons
MichaelSimons merged commit 7a5c578 into main Jun 29, 2026
27 checks passed
@MichaelSimons
MichaelSimons deleted the michaelsimons/fix-binlog-artifact-attempt-naming branch June 29, 2026 21:47
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jun 30, 2026
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