ci: keep the cache probe running past an expected failure (#234)
The runner starts `shell: bash` steps as `bash -e -o pipefail`, so run 453 stopped at the first TIMEOUT instead of probing the other addresses. Each probe now swallows its own exit code, and the env listing and the forge lookup no longer abort the step when they come back empty. Refs #234 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
1326ba1bcc
commit
68aef2a74a
1 changed files with 8 additions and 6 deletions
|
|
@ -16,6 +16,9 @@ name: Diag — cache server reachability (#234)
|
|||
#
|
||||
# Steps that use bash features set `shell: bash`: inside a container the runner
|
||||
# defaults to `sh`, and a job-level `defaults` block is refused by the runner.
|
||||
# The runner starts those steps as `bash -e -o pipefail`, so every probe that
|
||||
# is expected to fail must swallow its own exit code (run 453 stopped at the
|
||||
# first TIMEOUT for that reason).
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
|
@ -35,8 +38,8 @@ jobs:
|
|||
shell: bash
|
||||
run: |
|
||||
echo "Runner-provided variables (names only):"
|
||||
compgen -e | grep -E 'ACTIONS|RUNNER|FORGEJO|GITEA' | sort | sed 's/^/ /'
|
||||
compgen -e | grep -E '_RUNNER_VERSION$' | while read -r v; do echo " $v=${!v}"; done
|
||||
compgen -e | grep -E 'ACTIONS|RUNNER|FORGEJO|GITEA' | sort | sed 's/^/ /' || true
|
||||
compgen -e | grep -E '_RUNNER_VERSION$' | while read -r v; do echo " $v=${!v}"; done || true
|
||||
|
||||
url="${ACTIONS_CACHE_URL:-}"
|
||||
if [ -z "$url" ]; then
|
||||
|
|
@ -58,7 +61,7 @@ jobs:
|
|||
case "$host" in *:*) shown="[$host]" ;; esac
|
||||
echo
|
||||
echo "Cache address advertised by the runner: $scheme://$shown:$port/<path redacted>"
|
||||
forge=$(getent ahostsv4 git.lacompagniemaximus.com | awk '{ print $1; exit }')
|
||||
forge=$(getent ahostsv4 git.lacompagniemaximus.com | awk '{ print $1; exit }') || true
|
||||
echo "git.lacompagniemaximus.com resolves to (IPv4): ${forge:-unresolved}"
|
||||
echo "Container addresses: $(hostname -I 2>/dev/null || echo unknown)"
|
||||
gw_hex=$(awk '$2 == "00000000" { print $3; exit }' /proc/net/route)
|
||||
|
|
@ -71,8 +74,7 @@ jobs:
|
|||
probe() {
|
||||
local label=$1 h=$2 p=$3 start ms rc err verdict
|
||||
start=$(date +%s%N)
|
||||
err=$(timeout 10 bash -c "exec 3<>/dev/tcp/$h/$p" 2>&1)
|
||||
rc=$?
|
||||
err=$(timeout 10 bash -c "exec 3<>/dev/tcp/$h/$p" 2>&1) && rc=0 || rc=$?
|
||||
ms=$(( ($(date +%s%N) - start) / 1000000 ))
|
||||
case $rc in
|
||||
0) verdict="OPEN" ;;
|
||||
|
|
@ -114,7 +116,7 @@ jobs:
|
|||
key="diag-234-$(date -u +%Y%m%dT%H%M%SZ)-$RANDOM"
|
||||
mkdir -p probe-payload
|
||||
printf '%s' "$key" > probe-payload/stamp
|
||||
echo "key=$key" >> "$GITHUB_OUTPUT"
|
||||
echo "key=$key" >> "${GITHUB_OUTPUT:-$FORGEJO_OUTPUT}"
|
||||
echo "payload key: $key"
|
||||
|
||||
- name: Save it (actions/cache/save)
|
||||
|
|
|
|||
Loading…
Reference in a new issue