fix(hooks): restore lifecycle hook output visibility during azd up#8263
fix(hooks): restore lifecycle hook output visibility during azd up#8263vhvb1989 wants to merge 3 commits into
Conversation
PausePreviewer() was being called at graph build time in up_graph.go, before any steps execute. This caused ShowPreviewer() to return io.Discard for the entire Run() duration, silencing all lifecycle hook output (preprovision, postprovision, predeploy, postdeploy) during �zd up. The fix moves PausePreviewer() into startDeployTicker (called via tickerOnce.Do when the first publish or deploy step begins). The previewer is now only suppressed during the publish/deploy phase when the progress table is actually rendering — not during the earlier provision and hook phases. Adds a regression test (TestAskerConsole_PausePreviewer_DiscardsHookOutput) documenting the broken behavior and the PreviewerPauser mechanism. Fixes #8237. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
- Move PausePreviewer() before StartTicker() to close race window - Reword test assert message to clarify PausePreviewer behavior vs bug Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Fixes #8237 — lifecycle hook output (
preprovision,postprovision,predeploy) is restored duringazd up.Note:
postdeployhook output is still suppressed becausepostdeployruns as a graph step beforeRunWithResultreturns (while the deploy progress ticker is still active). Restoringpostdeployoutput requires adding a dedicated graph step to stop the ticker between deploy and postdeploy — tracked as a follow-up.Root Cause
Introduced in 1.25.0 by PR #7776 (the exegraph rewrite). In
up_graph.go,PausePreviewer()was called at graph build time, before any steps execute:This set
previewerSuppressed = truefor the entireRun()duration. When lifecycle hooks later calledShowPreviewer()inhooks_runner.go, they receivedio.Discard— silently discarding all hook stdout.Pre-1.25.0:
azd upused aworkflow.Runnerspawningazd provision+azd deployas sub-processes.PausePreviewerdid not exist — hooks always got real writers.Fix
Move
PausePreviewer()intostartDeployTicker, which is called viatickerOnce.Doonly when the first publish or deploy step begins (i.e., when the deploy progress table is actually rendering). The previewer is no longer suppressed during the provision + hook phases.Testing
TestAskerConsole_PausePreviewer_DiscardsHookOutputtopkg/input/console_test.godocumenting thePreviewerPausermechanism and the window during which hooks must not be suppressed.