Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
c3498bda76 |
@@ -187,16 +187,16 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
echo "🚀 Testing ${{ needs.create-release.outputs.version }} deployment locally..."
|
echo "🚀 Testing ${{ needs.create-release.outputs.version }} deployment locally..."
|
||||||
|
|
||||||
# Create a dedicated network so we can resolve by container name
|
# Create a dedicated network so we can resolve by container name
|
||||||
docker network create ci_net || true
|
docker network create ci_net || true
|
||||||
|
|
||||||
# Pull the built image
|
# Pull the built image
|
||||||
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.create-release.outputs.version }}
|
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.create-release.outputs.version }}
|
||||||
|
|
||||||
# Stop & remove any existing container
|
# Stop & remove any existing container
|
||||||
docker rm -f ping-river-monitor-test 2>/dev/null || true
|
docker rm -f ping-river-monitor-test 2>/dev/null || true
|
||||||
|
|
||||||
# Start the container on the user-defined network
|
# Start the container on the user-defined network
|
||||||
docker run -d \
|
docker run -d \
|
||||||
--name ping-river-monitor-test \
|
--name ping-river-monitor-test \
|
||||||
@@ -205,24 +205,24 @@ jobs:
|
|||||||
-e LOG_LEVEL=INFO \
|
-e LOG_LEVEL=INFO \
|
||||||
-e DB_TYPE=sqlite \
|
-e DB_TYPE=sqlite \
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.create-release.outputs.version }}
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.create-release.outputs.version }}
|
||||||
|
|
||||||
echo "✅ Container started for testing"
|
echo "✅ Container started for testing"
|
||||||
|
|
||||||
- name: Health check after deployment
|
- name: Health check after deployment
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
echo "⏳ Waiting for application to start..."
|
echo "⏳ Waiting for application to start..."
|
||||||
|
|
||||||
# Pull a curl-only image for probing (keeps your app image slim)
|
# Pull a curl-only image for probing (keeps your app image slim)
|
||||||
docker pull curlimages/curl:8.10.1
|
docker pull curlimages/curl:8.10.1
|
||||||
|
|
||||||
# Helper: curl via a sibling container on the SAME Docker network
|
# Helper: curl via a sibling container on the SAME Docker network
|
||||||
probe() {
|
probe() {
|
||||||
local url="$1"
|
local url="$1"
|
||||||
docker run --rm --network ci_net curlimages/curl:8.10.1 \
|
docker run --rm --network ci_net curlimages/curl:8.10.1 \
|
||||||
-sS --max-time 5 --connect-timeout 3 -w "HTTP_CODE:%{http_code}" "$url" || true
|
-sS --max-time 5 --connect-timeout 3 -w "HTTP_CODE:%{http_code}" "$url" || true
|
||||||
}
|
}
|
||||||
|
|
||||||
# Wait for /health (up to ~3m 45s)
|
# Wait for /health (up to ~3m 45s)
|
||||||
for i in {1..15}; do
|
for i in {1..15}; do
|
||||||
echo "🔍 Attempt $i/15: checking http://ping-river-monitor-test:8000/health"
|
echo "🔍 Attempt $i/15: checking http://ping-river-monitor-test:8000/health"
|
||||||
@@ -246,7 +246,7 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "🧪 Testing API endpoints…"
|
echo "🧪 Testing API endpoints…"
|
||||||
endpoints=("health" "docs" "stations" "metrics")
|
endpoints=("health" "docs" "stations" "metrics")
|
||||||
for ep in "${endpoints[@]}"; do
|
for ep in "${endpoints[@]}"; do
|
||||||
@@ -262,7 +262,7 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "✅ All health checks passed!"
|
echo "✅ All health checks passed!"
|
||||||
|
|
||||||
- name: (Fallback) Probe via host-published port
|
- name: (Fallback) Probe via host-published port
|
||||||
@@ -276,6 +276,7 @@ jobs:
|
|||||||
-sS --max-time 5 --connect-timeout 3 -w "HTTP_CODE:%{http_code}\n" \
|
-sS --max-time 5 --connect-timeout 3 -w "HTTP_CODE:%{http_code}\n" \
|
||||||
"http://$HOST_GATEWAY:8080/health" || true
|
"http://$HOST_GATEWAY:8080/health" || true
|
||||||
|
|
||||||
|
|
||||||
- name: Container logs and cleanup
|
- name: Container logs and cleanup
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
|
Reference in New Issue
Block a user