ci(gitea): update health check to use container IP
CI Pipeline / HTML Lint (push) Successful in 7s
Deploy QA / Build and Push (push) Successful in 13s
CI Pipeline / Build Docker Image (push) Failing after 1m35s
CI Pipeline / Security Scan (push) Has been skipped
Deploy QA / Deploy to QA (push) Failing after 1s
CI Pipeline / Generate Summary (push) Failing after 1s
Deploy QA / Notification (push) Failing after 1s
CI Pipeline / HTML Lint (push) Successful in 7s
Deploy QA / Build and Push (push) Successful in 13s
CI Pipeline / Build Docker Image (push) Failing after 1m35s
CI Pipeline / Security Scan (push) Has been skipped
Deploy QA / Deploy to QA (push) Failing after 1s
CI Pipeline / Generate Summary (push) Failing after 1s
Deploy QA / Notification (push) Failing after 1s
remove published port mapping and use docker-inspected internal container IP for health checks to avoid port conflicts and reduce exposed network ports
This commit is contained in:
@@ -76,11 +76,10 @@ jobs:
|
||||
-e GIT_COMMIT=${{ gitea.sha }} \
|
||||
-e GIT_BRANCH=${{ gitea.ref_name }} \
|
||||
-e DEPLOY_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
|
||||
-p 8080:80 \
|
||||
ci-image:latest
|
||||
|
||||
CI_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ci-test)
|
||||
for i in $(seq 1 12); do
|
||||
if curl -sf http://localhost:8080/health > /dev/null 2>&1; then
|
||||
if curl -sf http://$CI_IP/health > /dev/null 2>&1; then
|
||||
echo "::notice::Health check passed"
|
||||
docker logs ci-test 2>&1 || true
|
||||
docker stop ci-test
|
||||
@@ -89,7 +88,6 @@ jobs:
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
|
||||
echo "::error::Health check failed after 60 seconds"
|
||||
docker logs ci-test 2>&1 || true
|
||||
docker stop ci-test
|
||||
|
||||
Reference in New Issue
Block a user