From 223b8d6100b192a4963868a3080ca761a85cb499 Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Mon, 5 Oct 2026 21:26:23 +0200 Subject: [PATCH] the gateway is read from the kernel table, because this job image has no ip command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Run 2355, image job: `ip: command not found`, exit 127 — the step that names the address died one line in, before the gate ever ran. /proc/net/route carries the same default route; its gateway is hex little-endian, and bash turns it back into a dotted quad with no helper at all (0100110A → 10.17.0.1). --- .github/workflows/ci.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ab65db..ab5c03e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -235,8 +235,12 @@ jobs: - name: Name the address the job can reach the published ports on run: | set -eu - GW=$(ip route | awk '/default/ {print $3; exit}') - [ -n "$GW" ] || { echo "no default route out of the job container"; exit 1; } + # `ip` is not in this image (measured: `ip: command not found`, exit 127), + # so the route is read from the kernel's own table. The gateway there is + # hex, little-endian, and bash turns it back into dotted quad. + GWHEX=$(awk '$2=="00000000" {print $3; exit}' /proc/net/route) + [ -n "$GWHEX" ] || { echo "no default route in /proc/net/route"; exit 1; } + GW=$(printf '%d.%d.%d.%d' "0x${GWHEX:6:2}" "0x${GWHEX:4:2}" "0x${GWHEX:2:2}" "0x${GWHEX:0:2}") echo "OPENWAF_EDGE_HOST=$GW" >> "$GITHUB_ENV" echo "the gate will ask the edge at $GW" @@ -363,8 +367,12 @@ jobs: - name: Name the address the job can reach the published ports on run: | set -eu - GW=$(ip route | awk '/default/ {print $3; exit}') - [ -n "$GW" ] || { echo "no default route out of the job container"; exit 1; } + # `ip` is not in this image (measured: `ip: command not found`, exit 127), + # so the route is read from the kernel's own table. The gateway there is + # hex, little-endian, and bash turns it back into dotted quad. + GWHEX=$(awk '$2=="00000000" {print $3; exit}' /proc/net/route) + [ -n "$GWHEX" ] || { echo "no default route in /proc/net/route"; exit 1; } + GW=$(printf '%d.%d.%d.%d' "0x${GWHEX:6:2}" "0x${GWHEX:4:2}" "0x${GWHEX:2:2}" "0x${GWHEX:0:2}") echo "OPENWAF_EDGE_HOST=$GW" >> "$GITHUB_ENV" echo "the gate will ask the edge at $GW"