ci(diag): probe the runner cache server from a job container — do not merge (#234) #374
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
|
# 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.
|
# 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:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
@ -35,8 +38,8 @@ jobs:
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "Runner-provided variables (names only):"
|
echo "Runner-provided variables (names only):"
|
||||||
compgen -e | grep -E 'ACTIONS|RUNNER|FORGEJO|GITEA' | sort | sed 's/^/ /'
|
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
|
compgen -e | grep -E '_RUNNER_VERSION$' | while read -r v; do echo " $v=${!v}"; done || true
|
||||||
|
|
||||||
url="${ACTIONS_CACHE_URL:-}"
|
url="${ACTIONS_CACHE_URL:-}"
|
||||||
if [ -z "$url" ]; then
|
if [ -z "$url" ]; then
|
||||||
|
|
@ -58,7 +61,7 @@ jobs:
|
||||||
case "$host" in *:*) shown="[$host]" ;; esac
|
case "$host" in *:*) shown="[$host]" ;; esac
|
||||||
echo
|
echo
|
||||||
echo "Cache address advertised by the runner: $scheme://$shown:$port/<path redacted>"
|
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 "git.lacompagniemaximus.com resolves to (IPv4): ${forge:-unresolved}"
|
||||||
echo "Container addresses: $(hostname -I 2>/dev/null || echo unknown)"
|
echo "Container addresses: $(hostname -I 2>/dev/null || echo unknown)"
|
||||||
gw_hex=$(awk '$2 == "00000000" { print $3; exit }' /proc/net/route)
|
gw_hex=$(awk '$2 == "00000000" { print $3; exit }' /proc/net/route)
|
||||||
|
|
@ -71,8 +74,7 @@ jobs:
|
||||||
probe() {
|
probe() {
|
||||||
local label=$1 h=$2 p=$3 start ms rc err verdict
|
local label=$1 h=$2 p=$3 start ms rc err verdict
|
||||||
start=$(date +%s%N)
|
start=$(date +%s%N)
|
||||||
err=$(timeout 10 bash -c "exec 3<>/dev/tcp/$h/$p" 2>&1)
|
err=$(timeout 10 bash -c "exec 3<>/dev/tcp/$h/$p" 2>&1) && rc=0 || rc=$?
|
||||||
rc=$?
|
|
||||||
ms=$(( ($(date +%s%N) - start) / 1000000 ))
|
ms=$(( ($(date +%s%N) - start) / 1000000 ))
|
||||||
case $rc in
|
case $rc in
|
||||||
0) verdict="OPEN" ;;
|
0) verdict="OPEN" ;;
|
||||||
|
|
@ -114,7 +116,7 @@ jobs:
|
||||||
key="diag-234-$(date -u +%Y%m%dT%H%M%SZ)-$RANDOM"
|
key="diag-234-$(date -u +%Y%m%dT%H%M%SZ)-$RANDOM"
|
||||||
mkdir -p probe-payload
|
mkdir -p probe-payload
|
||||||
printf '%s' "$key" > probe-payload/stamp
|
printf '%s' "$key" > probe-payload/stamp
|
||||||
echo "key=$key" >> "$GITHUB_OUTPUT"
|
echo "key=$key" >> "${GITHUB_OUTPUT:-$FORGEJO_OUTPUT}"
|
||||||
echo "payload key: $key"
|
echo "payload key: $key"
|
||||||
|
|
||||||
- name: Save it (actions/cache/save)
|
- name: Save it (actions/cache/save)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue