the compose gates are pointed at the host address, because the job's own loopback is not where the ports are published
Run 2350 (b402ec4) got past the mount: the stack came up, the edge container
reached `healthy`, and the console gate died 8s later with curl exit 7 — a
connection refused to http://127.0.0.1:8090. The image job was further along but
showing the same face of it (empty curl bodies reaching a json decoder).
compose publishes the edge's port on the host. The job that curls it is a
container with its own network namespace, so 127.0.0.1:<published port> is not the
same place. The fix is the address the job's own default route names — the host's
address on that network — and compose publishes on 0.0.0.0, so the published port
is listening there. The step prints it into the log so the next run says which
address it asked.
Cross-reference for the platform, not invented here: ~/work/tskr documents the
same asymmetry from the other side in docker/test/workspace-mount.sh — the job
workspace is a named volume at /workspace/<owner>/<repo> that the host daemon
cannot see, `docker build` survives it because the context streams from the
client, and only `-v` is resolved daemon-side. tskr's answer is to run its gates
in sibling containers; openwaf's gates are shell + curl + node, so the smaller
answer is the volume for the file mount (previous commit) and the host address
for the port.
This commit is contained in:
@@ -224,6 +224,22 @@ jobs:
|
||||
docker run --rm -i -v "$VOL:/conf" busybox:1.37 sh -c 'cat > /conf/default.conf' < deploy/upstream.conf
|
||||
docker run --rm -v "$VOL:/conf" busybox:1.37 sh -c 'wc -c /conf/default.conf'
|
||||
|
||||
# The second half of the same asymmetry: compose publishes the edge's port on
|
||||
# the HOST, while the job that curls it lives in its own network namespace, so
|
||||
# 127.0.0.1:<port> is refused there. Measured on run 2350: the edge container
|
||||
# reached `healthy`, and the gate's first admin call died with curl exit 7.
|
||||
# The default-route address of the job container is the host's own address on
|
||||
# that network, and compose publishes on 0.0.0.0, so that is the address the
|
||||
# gate has to be pointed at. (tskr solves the same platform quirk by running
|
||||
# its gates in sibling containers — see docker/test/workspace-mount.sh there.)
|
||||
- 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; }
|
||||
echo "OPENWAF_EDGE_HOST=$GW" >> "$GITHUB_ENV"
|
||||
echo "the gate will ask the edge at $GW"
|
||||
|
||||
# Brings up edge + nginx, waits for the image's own HEALTHCHECK, asserts
|
||||
# over a socket, and tears the stack down on exit.
|
||||
- name: Compose smoke — the deployed image
|
||||
@@ -240,7 +256,7 @@ jobs:
|
||||
# guessed — see the comment in docker-compose.yml.
|
||||
COMPOSE_PROJECT_NAME: openwafci-image
|
||||
EDGE_PORT: "8080"
|
||||
EDGE: http://127.0.0.1:8080
|
||||
EDGE: http://${{ env.OPENWAF_EDGE_HOST }}:8080
|
||||
run: ./scripts/ci-gates.sh compose-smoke
|
||||
|
||||
# The console is a page, and a page fails in ways curl cannot see: a typo in
|
||||
@@ -336,6 +352,22 @@ jobs:
|
||||
docker run --rm -i -v "$VOL:/conf" busybox:1.37 sh -c 'cat > /conf/default.conf' < deploy/upstream.conf
|
||||
docker run --rm -v "$VOL:/conf" busybox:1.37 sh -c 'wc -c /conf/default.conf'
|
||||
|
||||
# The second half of the same asymmetry: compose publishes the edge's port on
|
||||
# the HOST, while the job that curls it lives in its own network namespace, so
|
||||
# 127.0.0.1:<port> is refused there. Measured on run 2350: the edge container
|
||||
# reached `healthy`, and the gate's first admin call died with curl exit 7.
|
||||
# The default-route address of the job container is the host's own address on
|
||||
# that network, and compose publishes on 0.0.0.0, so that is the address the
|
||||
# gate has to be pointed at. (tskr solves the same platform quirk by running
|
||||
# its gates in sibling containers — see docker/test/workspace-mount.sh there.)
|
||||
- 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; }
|
||||
echo "OPENWAF_EDGE_HOST=$GW" >> "$GITHUB_ENV"
|
||||
echo "the gate will ask the edge at $GW"
|
||||
|
||||
- name: Console smoke — the page, not only its endpoints
|
||||
env:
|
||||
# Written into the job's workspace so the next step can publish it.
|
||||
@@ -348,7 +380,7 @@ jobs:
|
||||
COMPOSE_PROJECT_NAME: openwafci-console
|
||||
COMPOSE_FILE: docker-compose.yml:docker-compose.ci.yml
|
||||
EDGE_PORT: "8090"
|
||||
EDGE: http://127.0.0.1:8090
|
||||
EDGE: http://${{ env.OPENWAF_EDGE_HOST }}:8090
|
||||
run: ./scripts/ci-gates.sh console
|
||||
|
||||
# always(): the failure case is the one worth looking at.
|
||||
|
||||
Reference in New Issue
Block a user