Skip to content

Commit a57c133

Browse files
committed
ci: require HTTP 200 from the archive canary
The canary checked redirects and final host but never the response status, and curl ran without --fail. A 401 or 404 reports zero redirects with an Artifactory url_effective, so both assertions passed on a response that carried no archive — the same shape of false pass the canary was added to close, reintroduced one layer down. Raised in review of #2376. Captures %{http_code} and requires 200 before the redirect and host checks run. Verified the rejected path directly: status 404, redirects 0, host edge.urm.nvidia.com now fails instead of passing. Asserting the code rather than relying on --fail keeps the error message specific — it names the status, where --fail under set -e would kill the step with no diagnostic, which is how the newline bug in d77849f presented. Signed-off-by: Mark Chmarny <mark@chmarny.com>
1 parent d77849f commit a57c133

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,21 +168,28 @@ jobs:
168168
# at EOF even when it assigned every variable, so without it `set -e`
169169
# kills this step with no output at all — which is exactly how it
170170
# failed the first time.
171-
read -r redirects effective < <(
171+
read -r status redirects effective < <(
172172
printf 'header = "%s"\nurl = "%s"\n' "${auth}" "${url}" \
173173
| curl --config - -sSL --max-time 60 -o /dev/null \
174-
-w '%{num_redirects} %{url_effective}\n'
174+
-w '%{http_code} %{num_redirects} %{url_effective}\n'
175175
)
176+
echo "status: ${status}"
176177
echo "redirects: ${redirects}"
177178
echo "final URL host: $(printf '%s' "${effective}" | sed -E 's#^https?://([^/]+)/.*#\1#')"
178179
180+
# Status first. Without it a 401 or 404 also reports zero redirects
181+
# from the Artifactory host, so the two checks below would pass on a
182+
# response that carried no archive at all — the same shape of false
183+
# pass this canary was added to close.
184+
[ "${status}" = "200" ] \
185+
|| { echo "::error::archive probe returned HTTP ${status}, not 200; nothing was served"; exit 1; }
179186
[ "${redirects}" -eq 0 ] \
180187
|| { echo "::error::Artifactory redirected ${redirects} time(s) to ${effective}"; exit 1; }
181188
case "${effective}" in
182189
https://edge.urm.nvidia.com/*) ;;
183190
*) echo "::error::bytes came from ${effective}, not Artifactory"; exit 1 ;;
184191
esac
185-
echo "OK: Artifactory served the archive directly, no redirect to another origin"
192+
echo "OK: Artifactory served the archive directly (HTTP 200, no redirect to another origin)"
186193
187194
# Guards the guard. Both assertions above are satisfied by a job that
188195
# never fetches anything, which is how the first enforced run passed on a

0 commit comments

Comments
 (0)