Skip to content

Commit 177712f

Browse files
authored
fix(publish): surface vsce/ovsx errors under bash -e (#26)
## Why The `0.2.2` publish run on main failed with no diagnostic output. All four `vsce publish` matrix entries exited with code 1, but the only thing the logs showed between `##[group]vsce publish attempt 1/5` and `##[error]Process completed with exit code 1.` was *nothing* — vsce's actual error message vanished. Root cause: GitHub runs the script as `/usr/bin/bash -e {0}`. The `retry_publish` function captures command output with: ```bash output=$("$@" 2>&1) rc=$? echo "$output" ``` Under `set -e`, a failing command substitution `output=$(cmd)` terminates the script *before* the next line. So when vsce returned non-zero, bash killed the script at the assignment line — never echoed `$output`, never reached the retry classification, never hit the endgroup. The script just exited with code 1 carrying nothing useful. The previous single-target version of this workflow had the same bug latent; it never triggered because vsce always succeeded historically. Switching to the multi-target matrix exposed a real vsce failure and the latent bug ate the diagnostic. ## Fix Replace the bare assignment with an explicit `if/else`, which `set -e` is documented to handle correctly: ```bash if output=$("$@" 2>&1); then rc=0; else rc=$?; fi echo "$output" ``` Applied to both retry functions (vsce and ovsx). ## Recovery state - **VS Code Marketplace:** still on `0.2.0`. `0.2.2` never landed (vsce publish silently failed for all 4 targets). - **Open VSX:** has `0.2.2` for all 4 targets (the ovsx publishes succeeded). - **GitHub:** no `vscode-extension-v0.2.2` tag (finalize was skipped because publish failed). ## No version bump `0.2.2` is still missing from the Marketplace, so the `prepare` gate will let a re-run proceed. The ovsx side will hit "already exists" → idempotent success in the retry function. The vsce side will either publish for real this time, or fail with an actual error message we can act on. If vsce errors with a real message after this, expect a follow-up PR to address whatever it actually is (auth scope, validation, manifest mismatch, rate limit, etc.). ## Test plan - [x] YAML parses; both retry functions updated - [ ] After merge: push to main triggers re-run; verify vsce output is now visible in the logs whether it succeeds or fails - [ ] If vsce succeeds: all 4 platform builds appear on Marketplace under `0.2.2`, finalize runs, tag + release created - [ ] If vsce fails: open follow-up with the actual error
2 parents 46ea89b + 4dc6f2b commit 177712f

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

.github/workflows/publish.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,12 @@ jobs:
239239
local i output rc wait
240240
for (( i=1; i<=attempts; i++ )); do
241241
echo "::group::vsce publish attempt $i/$attempts (${{ matrix.target }})"
242-
output=$("$@" 2>&1)
243-
rc=$?
242+
# The if/else is load-bearing: GitHub runs `bash -e`, and a
243+
# failed command substitution `output=$(cmd)` under set -e
244+
# terminates the script *before* the echo below can run, so
245+
# vsce/ovsx errors get swallowed silently. The if-form is
246+
# explicitly handled by set -e and lets both branches set rc.
247+
if output=$("$@" 2>&1); then rc=0; else rc=$?; fi
244248
echo "$output"
245249
echo "::endgroup::"
246250
@@ -302,8 +306,12 @@ jobs:
302306
local i output rc wait
303307
for (( i=1; i<=attempts; i++ )); do
304308
echo "::group::ovsx publish attempt $i/$attempts (${{ matrix.target }})"
305-
output=$("$@" 2>&1)
306-
rc=$?
309+
# The if/else is load-bearing: GitHub runs `bash -e`, and a
310+
# failed command substitution `output=$(cmd)` under set -e
311+
# terminates the script *before* the echo below can run, so
312+
# vsce/ovsx errors get swallowed silently. The if-form is
313+
# explicitly handled by set -e and lets both branches set rc.
314+
if output=$("$@" 2>&1); then rc=0; else rc=$?; fi
307315
echo "$output"
308316
echo "::endgroup::"
309317

0 commit comments

Comments
 (0)