fix: handle StaticSitesClient stderr and non-zero exit codes#988
Closed
LongOddCode wants to merge 3 commits intoAzure:mainfrom
Closed
fix: handle StaticSitesClient stderr and non-zero exit codes#988LongOddCode wants to merge 3 commits intoAzure:mainfrom
LongOddCode wants to merge 3 commits intoAzure:mainfrom
Conversation
The deploy command silently ignored failures from the StaticSitesClient binary. When the binary crashed (e.g., missing native dependencies on slim Docker images), the CLI reported success and exited with code 0. This fix: - Adds stderr handler to capture binary error output - Adds else branch for non-zero exit codes with diagnostic message - Calls process.exit(1) on failure so CI/CD detects it Fixes Azure#536, Azure#594 Refs: ICM 21000000909499
- stderr is captured and passed to logger.error - Non-zero exit code triggers spinner.fail and error message - process.exit(1) is called on binary failure - Success path (exit code 0) remains unchanged
The ReturnType<typeof vi.spyOn> didn't match the 'never' return type of process.exit, causing tsc to fail in CI format check.
Contributor
Author
|
Closing fork-based PR. Reopening as direct branch PR for CI with secrets. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
swa deploycommand silently ignores failures from theStaticSitesClientbinary. When the binary crashes (e.g., missing native dependencies onnode:22-slimDocker images), the CLI reports success and exits with code 0. This causes CI/CD pipelines to mark deployments as succeeded when no content was actually uploaded.Root Cause
Three bugs in
src/cli/commands/deploy/deploy.ts:child.stderris never read; all binary errors are silently discardedchild.on("close")only handlescode === 0; no else branchprocess.exit(1)on failure; CI sees exit 0Fix
child.stderr.on("data", ...)handler to capture and log binary errorselsebranch for non-zero exit codes with a diagnostic message suggestinglddto check for missing shared librariesprocess.exit(1)on failure so CI/CD pipelines correctly detect deployment failuresImpact
This is a known issue since July 2022 affecting multiple CI/CD platforms:
Testing
tsc --noEmitpasses