Repository navigation
Fix notarization retry logging errors on intermediate attempts - #16669
Conversation
778f775 to
a112c0b
Compare
Add maxAttempts parameter to RunMSBuild. RealSignTool implements retry logic internally: intermediate failures are logged as warnings instead of errors (which permanently mark the MSBuild task as failed), and only the final failure after all retries logs an error. The notarization call site passes maxAttempts=6. The signing call site uses the default (1), preserving existing behavior. Co-authored-by: Copilot <[email protected]>
a112c0b to
e4acddc
Compare
we don't have warn-as-error in that context right? |
Add maxAttempts parameter to RunMSBuild. RealSignTool implements retry logic internally: intermediate failures are logged as warnings instead of errors (which permanently mark the MSBuild task as failed), and only the final failure after all retries logs an error. The notarization call site passes maxAttempts=6. The signing call site uses the default (1), preserving existing behavior. Port of dotnet/arcade#16669 Co-authored-by: Copilot <[email protected]>
LogWarning could be promoted to an error via MSBuildTreatAllWarningsAsErrors, defeating the retry fix. LogMessage with high importance is safe from promotion while still being visible in build output. Co-authored-by: Copilot <[email protected]>
|
Good catch - |
|
@copilot investigate and fix the test failures |
Head branch was pushed to by a user without write access
The failing test was Root cause: the retry loop was inside Fixed in d295a73 by moving the retry loop to |
|
@copilot minimize the difference that were introduced with this PR. The current state has some changes that are unnecessary from a diff point of view. |
…ressErrors parameter Agent-Logs-Url: https://github.com/dotnet/arcade/sessions/3acedfec-93e1-4b0d-91fc-ad58d5531623 Co-authored-by: ViktorHofer <[email protected]>
Done in cb48af7. Restored |
…rivate helper Agent-Logs-Url: https://github.com/dotnet/arcade/sessions/33a477c6-abdb-4db2-8c35-a1fc909296d3 Co-authored-by: ViktorHofer <[email protected]>
|
/backport to release/10.0 |
|
Started backporting to |
Problem
The notarization retry loop in
SignTool.cscallsRunMSBuildup to 5 times. However,RealSignTool.RunMSBuildcalls_log.LogError()when MSBuild fails (timeout or non-zero exit code). Since MSBuild'sTaskLoggingHelper.LogError()permanently marks the task as failed, intermediate retry failures poison the build even if a later retry succeeds. Additionally, usingLogWarningfor intermediate failures is unsafe becauseMSBuildTreatAllWarningsAsErrorscan promote warnings to errors.Fix
Added a
bool suppressErrorsparameter to the abstractRunMSBuildmethod. The existing retry loop inSignTool.AuthenticodeSignAndNotarizepassessuppressErrors: truefor all intermediate attempts andsuppressErrors: falseonly for the final attempt.RealSignTooluses this flag to branch betweenLogMessage(MessageImportance.High)(safe from warn-as-error) andLogError:LogMessage(MessageImportance.High)— does not poison the build and is safe from warn-as-error promotionSignToolis preserved unchangedsuppressErrors: false, preserving existing behaviorChanges
SignTool.cs- Updated abstractRunMSBuildsignature to addbool suppressErrors = false; addedsuppressErrors: attempt < maxRetriesto the notarizationRunMSBuildcall (loop structure and variable names are otherwise unchanged)RealSignTool.cs- Addedbool suppressErrorsparameter; branches onsuppressErrorsto useLogMessagevsLogErrorValidationOnlySignTool.cs- Signature update (no behavioral change)FakeSignTool.cs- Signature update (test subclass)To double check: