0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-05-22 21:45:24 +02:00

gate the container exec

This commit is contained in:
TheFox0x7 2026-04-20 22:01:30 +02:00
parent 61dd882049
commit 6a6f986aff
No known key found for this signature in database

View File

@ -32,7 +32,9 @@ WORK_DIR=$(mktemp -d)
FREE_PORT=$(node -e "const s=require('net').createServer();s.listen(0,'127.0.0.1',()=>{process.stdout.write(String(s.address().port));s.close()})") FREE_PORT=$(node -e "const s=require('net').createServer();s.listen(0,'127.0.0.1',()=>{process.stdout.write(String(s.address().port));s.close()})")
cleanup() { cleanup() {
$CONTAINER_RUNTIME stop gitea-e2e-runner if [ -z "$PLAYWRIGHT_CONTAINER" ]; then
$CONTAINER_RUNTIME stop gitea-e2e-runner
fi
if [ -n "${SERVER_PID:-}" ]; then if [ -n "${SERVER_PID:-}" ]; then
kill "$SERVER_PID" 2>/dev/null || true kill "$SERVER_PID" 2>/dev/null || true
wait "$SERVER_PID" 2>/dev/null || true wait "$SERVER_PID" 2>/dev/null || true
@ -40,11 +42,14 @@ cleanup() {
rm -rf "$WORK_DIR" rm -rf "$WORK_DIR"
} }
trap cleanup EXIT trap cleanup EXIT
# Start playwright worker
$CONTAINER_RUNTIME run --network=host --name gitea-e2e-runner -d --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.59.1-noble /bin/sh -c "npx -y playwright@1.59.1 run-server --port 4000 --host 0.0.0.0"
if ! wait_for_container 5; then if [ -z "$PLAYWRIGHT_CONTAINER" ]; then
exit 1 # Start playwright worker
$CONTAINER_RUNTIME run --network=host --name gitea-e2e-runner -d --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.59.1-noble /bin/sh -c "npx -y playwright@1.59.1 run-server --port 4000 --host 0.0.0.0"
if ! wait_for_container 5; then
exit 1
fi
fi fi
@ -144,4 +149,7 @@ export GITEA_TEST_E2E_PASSWORD
export GITEA_TEST_E2E_EMAIL export GITEA_TEST_E2E_EMAIL
export GITEA_TEST_E2E_TIMEOUT_FACTOR export GITEA_TEST_E2E_TIMEOUT_FACTOR
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4000/ pnpm exec playwright test "$@" if [ -z "$PLAYWRIGHT_CONTAINER" ]; then
export PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4000/
fi
pnpm exec playwright test "$@"