ci: run the image smoke test in the job network
ci / checks (push) Successful in 1m48s
ci / test (push) Successful in 2m3s
ci / chart (push) Successful in 6s
ci / web (push) Successful in 16s
ci / docker (push) Successful in 6s
ci / publish-edge-image (push) Failing after 4s
ci / publish-edge-chart (push) Skipped
ci / checks (push) Successful in 1m48s
ci / test (push) Successful in 2m3s
ci / chart (push) Successful in 6s
ci / web (push) Successful in 16s
ci / docker (push) Successful in 6s
ci / publish-edge-image (push) Failing after 4s
ci / publish-edge-chart (push) Skipped
The job container cannot reach a port published on the Docker host loopback. Start the app in the job's network namespace and check it on localhost.
This commit is contained in:
1 parent
22c838eafe
commit
135dd3143c
1 file changed
+16
-2
+16
-2
@@ -136,8 +136,22 @@ jobs:
|
||||
run: |
|
||||
docker rm -f rhema-together-ci || true
|
||||
trap 'docker rm -f rhema-together-ci || true' EXIT
|
||||
docker run -d --name rhema-together-ci \
|
||||
-p 127.0.0.1:18000:7800 rhema-together:ci
|
||||
|
||||
# The job runs in a container with the host Docker socket. A
|
||||
# published port binds the host loopback, which the job cannot
|
||||
# reach. Run the app in the job's network namespace instead.
|
||||
job_container="$(hostname)"
|
||||
if ! docker inspect "$job_container" >/dev/null 2>&1; then
|
||||
job_container="$(docker ps --filter 'name=GITEA-ACTIONS-TASK' --format '{{.ID}}' | head -n1)"
|
||||
fi
|
||||
if [ -n "$job_container" ] && [ "$(docker inspect -f '{{.HostConfig.NetworkMode}}' "$job_container")" != "host" ]; then
|
||||
network="container:${job_container}"
|
||||
else
|
||||
network="host"
|
||||
fi
|
||||
|
||||
docker run -d --name rhema-together-ci --network "$network" \
|
||||
-e TOGETHER_LISTEN=127.0.0.1:18000 rhema-together:ci
|
||||
ok=0
|
||||
for i in $(seq 1 30); do
|
||||
if curl -fsS http://127.0.0.1:18000/api/bootstrap > /tmp/bootstrap.json; then
|
||||
|
||||
Reference in new issue
Block a user