fix: propagate context in remote build upload and log streaming#6922
fix: propagate context in remote build upload and log streaming#6922spboyer wants to merge 1 commit intoAzure:mainfrom
Conversation
- UploadBuildSource: use caller's ctx instead of context.Background() so blob upload respects cancellation (Ctrl+C) - streamLogs: replace bare time.Sleep with select on ctx.Done() so log polling responds to cancellation promptly Addresses finding 17 from Azure#6886 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR addresses context propagation issues in remote Azure Container Registry build operations to ensure cancellation signals (Ctrl+C) are properly respected. This is part of a broader performance review audit (Finding 17 from #6886).
Changes:
- Changed blob upload to use caller's context instead of
context.Background()so cancellation stops the upload immediately - Replaced bare
time.Sleep()with context-awareselectstatement in log polling loop to respond to cancellation within 1 second
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Description
Propagate caller context in remote ACR build operations so cancellation (Ctrl+C) is respected.
Closes: #6921
Parent: #6886 (Performance Review Audit -- Finding 17)
Changes
pkg/containerregistry/remote_build.go:UploadBuildSource: ChangedblobClient.UploadFile(context.Background(), ...)toblobClient.UploadFile(ctx, ...)so blob upload respects cancellationstreamLogs: Replacedtime.Sleep(1 * time.Second)withselect { case <-ctx.Done(): return ctx.Err() case <-time.After(1 * time.Second): }so log polling responds to Ctrl+C promptlyTesting
go buildclean