Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/DOCKER-CD-STAGING.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ jobs:
NEW_CONTAINER_NAME="${APP_NAME}-${NEW_PORT}"
docker run -d --name ${NEW_CONTAINER_NAME} --restart always \
-p ${NEW_PORT}:8080 \
-e JAVA_OPTS='-Xms256m -Xmx512m' \
-e SPRING_PROFILES_ACTIVE=staging \
-e SPRING_DATASOURCE_URL='${{ secrets.DB_URL }}' \
-e SPRING_DATASOURCE_USERNAME='${{ secrets.DB_USERNAME }}' \
Expand All @@ -116,7 +117,7 @@ jobs:
${IMAGE_NAME}:latest

echo "### 4. 헬스 체크를 시작합니다."
sleep 10
sleep 30

Copilot AI Jul 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Rather than a fixed 30-second sleep, consider implementing a configurable backoff loop or shorter interval retries to start health checks sooner when possible.

Suggested change
sleep 30
for wait_time in {1..6}; do
echo " > [${wait_time}/6] 초기화 상태 체크 중..."
response=$(curl -s http://localhost:${NEW_PORT}/actuator/health || true)
up_count=$(echo "$response" | grep -c '"status":"UP"')
if [ $up_count -ge 1 ]; then
echo " > ✅ 초기화 완료. 헬스 체크를 시작합니다."
break
fi
if [ $wait_time -eq 6 ]; then
echo " > ❌ 초기화 실패. 배포를 중단하고 새 컨테이너를 종료합니다."
docker rm -f ${NEW_CONTAINER_NAME}
exit 1
fi
sleep 5
done

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋은 제안 감사합니다!

확실히 고정된 sleep 시간으로 기다리는 것보다, 더 짧은 주기로 여러 번 상태를 체크해서 애플리케이션이 준비되는 즉시 다음 단계로 넘어가는 것이 훨씬 효율적이고 안정적인 방법이네요. 평균 배포 속도도 개선될 것 같습니다.

제안해주신 코드로 수정하여 반영하겠습니다. 리뷰 감사합니다!

for retry_count in {1..10}; do
echo " > [${retry_count}/10] 서버 상태 체크 중..."
response=$(curl -s http://localhost:${NEW_PORT}/actuator/health)
Expand Down
Loading