Skip to content

Commit d77849f

Browse files
committed
ci: add the trailing newline the redirect canary needs
The canary failed with exit 1 and printed nothing at all, which looked like a redirect finding and was not. `curl -w` emits no trailing newline, and `read` returns non-zero at EOF even when it has assigned every variable, so `set -e` killed the step before its first echo. Reproduced directly: read -r a b < <(printf 'X Y') -> exit 1, no output read -r a b < <(printf 'X Y\n') -> exit 0, "a=X b=Y" Adds `\n` to the -w format and a comment recording why it is load-bearing, since the failure mode is silent and easy to reintroduce. Signed-off-by: Mark Chmarny <mark@chmarny.com>
1 parent bb1762d commit d77849f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

.github/workflows/dgxc-goproxy-probe.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,14 @@ jobs:
164164
auth="$("${GOAUTH}" | grep -i '^Authorization:')"
165165
[ -n "${auth}" ] || { echo "::error::GOAUTH helper produced no Authorization header"; exit 1; }
166166
167+
# The trailing newline in -w is load-bearing. `read` returns non-zero
168+
# at EOF even when it assigned every variable, so without it `set -e`
169+
# kills this step with no output at all — which is exactly how it
170+
# failed the first time.
167171
read -r redirects effective < <(
168172
printf 'header = "%s"\nurl = "%s"\n' "${auth}" "${url}" \
169173
| curl --config - -sSL --max-time 60 -o /dev/null \
170-
-w '%{num_redirects} %{url_effective}'
174+
-w '%{num_redirects} %{url_effective}\n'
171175
)
172176
echo "redirects: ${redirects}"
173177
echo "final URL host: $(printf '%s' "${effective}" | sed -E 's#^https?://([^/]+)/.*#\1#')"

0 commit comments

Comments
 (0)