ci(diag): probe the runner cache server from a job container — do not merge (#234) #374

Closed
maximus wants to merge 3 commits from diag/234-cache-probe into main
Showing only changes of commit 68aef2a74a - Show all commits

View file

@ -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)