Skip to content

Commit bf0b7b2

Browse files
authored
fix: 헬스체크 grep 쿼팅 버그 수정 (#758)
- refactor: 액추에이터 포트 검사 방식 변경(status:UP -> http_status_code)
1 parent aedf4bc commit bf0b7b2

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

.github/workflows/dev-cd.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,11 @@ jobs:
153153
docker compose -p "${CONTAINER_BASE}-${NEW_SLOT}" -f docker-compose.dev.yml up -d solid-connection-dev
154154
155155
# 8. 헬스 체크 (앱 기동 대기, 최대 150초)
156+
# HTTP 200 = UP, 503 = DOWN (single-quote 내부 quoting 문제 없이 상태코드로 판단)
156157
echo "Waiting for app on management port ${MANAGEMENT_PORT}..."
157158
for i in $(seq 1 30); do
158-
STATUS=$(curl -s --connect-timeout 2 "http://localhost:${MANAGEMENT_PORT}/actuator/health" | grep -o '"status":"UP"' || true)
159-
[ "$STATUS" = '"status":"UP"' ] && { echo "App healthy (attempt ${i})"; break; }
159+
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 2 "http://localhost:${MANAGEMENT_PORT}/actuator/health" || true)
160+
[ "$HTTP_CODE" = "200" ] && { echo "App healthy (attempt ${i})"; break; }
160161
[ "$i" = "30" ] && {
161162
echo "Health check timed out after 150s" >&2
162163
docker stop "${CONTAINER_BASE}-${NEW_SLOT}" 2>/dev/null || true

.github/workflows/prod-cd.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,11 @@ jobs:
164164
docker compose -p "${CONTAINER_BASE}-${NEW_SLOT}" -f docker-compose.prod.yml up -d solid-connection-server
165165
166166
# 6. 헬스 체크 (앱 기동 대기, 최대 150초)
167+
# HTTP 200 = UP, 503 = DOWN (single-quote 내부 quoting 문제 없이 상태코드로 판단)
167168
echo "Waiting for app on management port ${MANAGEMENT_PORT}..."
168169
for i in $(seq 1 30); do
169-
STATUS=$(curl -s --connect-timeout 2 "http://localhost:${MANAGEMENT_PORT}/actuator/health" | grep -o '"status":"UP"' || true)
170-
[ "$STATUS" = '"status":"UP"' ] && { echo "App healthy (attempt ${i})"; break; }
170+
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 2 "http://localhost:${MANAGEMENT_PORT}/actuator/health" || true)
171+
[ "$HTTP_CODE" = "200" ] && { echo "App healthy (attempt ${i})"; break; }
171172
[ "$i" = "30" ] && {
172173
echo "Health check timed out after 150s" >&2
173174
docker stop "${CONTAINER_BASE}-${NEW_SLOT}" 2>/dev/null || true

0 commit comments

Comments
 (0)