Skip to content

Commit 0373059

Browse files
committed
ui: surface real yarn build_prod stderr in failed bazel actions
The old pattern captured yarn output into \$output then printed it on failure via `echo \$output` (unquoted) — which collapsed newlines, overflowed argv for large outputs, and produced literally just "Build Failed with Code: 1" in CI logs. Every release-time UI bundle failure has been undiagnosable for the same reason. Replace with direct streaming: yarn build_prod prints to stderr, bazel surfaces it on failure. The only thing we print on top is the exit code, in case it's useful as a header. Verified locally that the rule still builds the bundle cleanly on success.
1 parent fca42b1 commit 0373059

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

bazel/ui.bzl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ def _pl_webpack_library_impl(ctx):
8484
'pushd "$TMPPATH/src/ui" &> /dev/null',
8585
'tar -xzf "$BASE_PATH/{}"'.format(ctx.file.deps.path),
8686
'mv -f "$BASE_PATH/{}" src/pages/credits/licenses.json'.format(ctx.file.licenses.path),
87-
"retval=0",
88-
"output=`yarn build_prod 2>&1` || retval=$?",
89-
'[ "$retval" -eq 0 ] || (echo $output; echo "Build Failed with Code: $retval"; exit $retval)',
87+
# Stream yarn output directly so failures surface a usable stderr
88+
# in CI logs. The old `output=\`…\`; echo $output` pattern
89+
# swallowed newlines (unquoted echo) and produced empty failure
90+
# messages, making release breakage impossible to diagnose.
91+
"yarn build_prod || (echo 'Build Failed with Code: '$?; exit 1)",
9092
'cp dist/bundle.tar.gz "$BASE_PATH/{}"'.format(out.path),
9193
] + ui_shared_cmds_finish
9294

0 commit comments

Comments
 (0)