Reach QA's published ports from the smoke-qa job container via bridge gateway
The runner executes each job in its own container on docker's default bridge network, so "localhost" never resolves to the docker host - smoke-qa's direct Postgres connection and Playwright/API HTTP calls need the bridge gateway IP instead. Bind the db port to that same gateway IP (not 0.0.0.0) so it stays reachable only from sibling containers, not off-box.
This commit is contained in:
@@ -111,6 +111,16 @@ ensure_node() {
|
||||
export PATH="$install_dir/bin:$PATH"
|
||||
}
|
||||
|
||||
# The IP address on which a container published on 0.0.0.0/<gateway-ip> is
|
||||
# reachable from a sibling container on docker's default bridge network (i.e.
|
||||
# the docker host's bridge-side address, not its public interface). Used to
|
||||
# bind QA's db port narrowly - reachable by the smoke-qa job container, not
|
||||
# exposed off-box the way 0.0.0.0 would be.
|
||||
docker_bridge_gateway() {
|
||||
docker network inspect bridge -f '{{(index .IPAM.Config 0).Gateway}}' 2>/dev/null \
|
||||
|| ip route show default 2>/dev/null | awk '/default/ {print $3; exit}'
|
||||
}
|
||||
|
||||
registry_login() {
|
||||
require_registry_vars
|
||||
[[ -n "$REGISTRY_USER" ]] || fail "REGISTRY_USER env var is required to push images"
|
||||
|
||||
Reference in New Issue
Block a user