CI: Gitea Actions pipeline (build → unit → e2e) + pull-request workflow #9
+6
-44
@@ -15,49 +15,11 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Full-dind runner: job containers already reach the runner's own docker daemon
|
||||
# (pre-set DOCKER_HOST and/or a mounted /var/run/docker.sock) — no dind service.
|
||||
# Find a working endpoint and export it as DOCKER_HOST for all later steps.
|
||||
- name: Resolve docker daemon
|
||||
run: |
|
||||
set -u
|
||||
|
||||
# 1) A pre-set DOCKER_HOST that answers is used as-is, no probing.
|
||||
if [ -n "${DOCKER_HOST:-}" ]; then
|
||||
i=0
|
||||
while [ "$i" -lt 5 ]; do
|
||||
if docker version --format '{{.Server.Version}}' >/dev/null 2>&1; then
|
||||
echo "using pre-set DOCKER_HOST=$DOCKER_HOST"
|
||||
echo "DOCKER_HOST=$DOCKER_HOST" >> "$GITHUB_ENV"
|
||||
exit 0
|
||||
fi
|
||||
i=$((i+1)); sleep 2
|
||||
done
|
||||
fi
|
||||
|
||||
# 2) Otherwise probe candidates in order (short retry each).
|
||||
tried=""
|
||||
for ep in "${DOCKER_HOST:-}" unix:///var/run/docker.sock tcp://localhost:2375 tcp://localhost:2376 tcp://docker:2375 tcp://docker:2376; do
|
||||
[ -n "$ep" ] || continue
|
||||
case " $tried " in *" $ep "*) continue ;; esac
|
||||
tried="$tried $ep"
|
||||
i=0
|
||||
while [ "$i" -lt 10 ]; do
|
||||
if DOCKER_HOST="$ep" docker version --format '{{.Server.Version}}' >/dev/null 2>&1; then
|
||||
echo "using probed endpoint $ep"
|
||||
echo "DOCKER_HOST=$ep" >> "$GITHUB_ENV"
|
||||
exit 0
|
||||
fi
|
||||
i=$((i+1)); sleep 2
|
||||
done
|
||||
done
|
||||
|
||||
echo "::error::no reachable docker daemon (tried: ${DOCKER_HOST:-<unset>}, unix:///var/run/docker.sock, tcp://localhost:2375, tcp://localhost:2376, tcp://docker:2375, tcp://docker:2376)" >&2
|
||||
exit 1
|
||||
|
||||
# Job and app containers share the daemon, so put them on one user-defined network
|
||||
# and reach the app by service DNS — no endpoint-derived URLs (the job's netns has
|
||||
# no default route on this runner). The alias `app` is declared in docker-compose.ci.yml.
|
||||
# The runner provides a working docker CLI out of the box (full-dind) — no endpoint
|
||||
# resolution needed. Job and app containers share the daemon, so put them on one
|
||||
# user-defined network and reach the app by service DNS (the job's netns has no
|
||||
# default route here, so host-IP URLs are unreliable). The alias `app` is declared
|
||||
# in docker-compose.ci.yml.
|
||||
- name: Prepare e2e network
|
||||
run: |
|
||||
set -u
|
||||
@@ -99,7 +61,7 @@ jobs:
|
||||
# flight-ci keeps it distinct from production. E2E_DEPLOY_CMD makes the config's
|
||||
# webServer block deploy + wait for readiness (http://app:3000 via service DNS);
|
||||
# E2E_COMPOSE_ARGS points state.spec.ts' mid-run `docker compose restart flight` at
|
||||
# the same file + project. DOCKER_HOST/E2E_BASE_URL come from GITHUB_ENV above.
|
||||
# the same file + project. E2E_BASE_URL comes from GITHUB_ENV (Prepare e2e network).
|
||||
- name: E2E (isolated stack in dind)
|
||||
env:
|
||||
PW_REMOTE_BROWSER: "0"
|
||||
|
||||
Reference in New Issue
Block a user