ci: use deterministic smoke test port

This commit is contained in:
2026-08-21 23:12:21 +08:00
parent b15fed5b6a
commit 85fa02f142
+2 -3
View File
@@ -138,10 +138,11 @@ pipeline {
exit 1 exit 1
fi fi
host_port=$((18080 + BUILD_NUMBER % 1000))
$DOCKER_CMD run --detach \ $DOCKER_CMD run --detach \
--name "$SMOKE_APP" \ --name "$SMOKE_APP" \
--network "$SMOKE_NETWORK" \ --network "$SMOKE_NETWORK" \
--publish 127.0.0.1::8080 \ --publish "127.0.0.1:${host_port}:8080" \
--env ASPNETCORE_ENVIRONMENT=Production \ --env ASPNETCORE_ENVIRONMENT=Production \
--env "ConnectionStrings__Default=Server=$SMOKE_MYSQL;Port=3306;Database=jizhi_smoke;User=jizhi;Password=jizhi-smoke-password" \ --env "ConnectionStrings__Default=Server=$SMOKE_MYSQL;Port=3306;Database=jizhi_smoke;User=jizhi;Password=jizhi-smoke-password" \
--env Jwt__Secret=jizhi-smoke-jwt-secret-at-least-32-characters \ --env Jwt__Secret=jizhi-smoke-jwt-secret-at-least-32-characters \
@@ -153,8 +154,6 @@ pipeline {
--env "Build__Version=$IMMUTABLE_TAG" \ --env "Build__Version=$IMMUTABLE_TAG" \
"$IMAGE_REF" >/dev/null "$IMAGE_REF" >/dev/null
host_port=$($DOCKER_CMD port "$SMOKE_APP" 8080/tcp | sed -n 's/.*://p' | head -n 1)
test -n "$host_port"
app_ready=0 app_ready=0
for attempt in $(seq 1 90); do for attempt in $(seq 1 90); do
if curl --fail --silent --show-error \ if curl --fail --silent --show-error \