Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
92 changes: 0 additions & 92 deletions .github/workflows/cd-api-dev.yml

This file was deleted.

91 changes: 0 additions & 91 deletions .github/workflows/cd-api-prod.yml

This file was deleted.

47 changes: 27 additions & 20 deletions .github/workflows/cd-internal-dev.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CD INTERNAL DEV
name: CD DEV

on:
push:
Expand All @@ -18,24 +18,33 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Grant execute permission for run-test-mysql.sh
run: chmod +x run-test-mysql.sh
working-directory: ./domain
- name: Start test containers
run: docker compose -f test-docker-compose.yml up -d

- name: Grant execute permission for run-test-redis.sh
run: chmod +x run-test-redis.sh
working-directory: ./common

- name: Run test mysql script
run: ./run-test-mysql.sh
working-directory: ./domain

- name: Run test redis script
run: ./run-test-redis.sh
working-directory: ./common

- name: Test & Build internal only
run: ./gradlew :internal:build
- name: Wait for MySQL to be ready
run: |
for i in $(seq 1 30); do
if docker exec payment-test-mysql mysqladmin ping -h localhost --silent 2>/dev/null; then
echo "MySQL is ready"
break
fi
echo "Waiting for MySQL... ($i/30)"
sleep 2
done

- name: Wait for Redis to be ready
run: |
for i in $(seq 1 30); do
if docker exec payment-test-redis redis-cli ping 2>/dev/null | grep -q PONG; then
echo "Redis is ready"
break
fi
echo "Waiting for Redis... ($i/30)"
sleep 2
done

- name: Test & Build
run: ./gradlew build
Comment on lines +21 to +47
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

레디니스 타임아웃 후에도 성공으로 진행됨

현재 루프는 준비되지 않아도 종료 후 다음 단계로 진행합니다. 서비스가 기동되지 않은 상태에서 테스트/빌드 및 이미지 푸시가 수행될 수 있어 CI 신뢰성이 떨어집니다. 타임아웃 시 명시적으로 실패 처리하세요.

🛠️ 타임아웃 시 실패 처리 추가
       - name: Wait for MySQL to be ready
         run: |
-          for i in $(seq 1 30); do
+          ready=0
+          for i in $(seq 1 30); do
             if docker exec payment-test-mysql mysqladmin ping -h localhost --silent 2>/dev/null; then
               echo "MySQL is ready"
+              ready=1
               break
             fi
             echo "Waiting for MySQL... ($i/30)"
             sleep 2
           done
+          if [ "$ready" -ne 1 ]; then
+            echo "MySQL did not become ready in time"
+            exit 1
+          fi

       - name: Wait for Redis to be ready
         run: |
-          for i in $(seq 1 30); do
+          ready=0
+          for i in $(seq 1 30); do
             if docker exec payment-test-redis redis-cli ping 2>/dev/null | grep -q PONG; then
               echo "Redis is ready"
+              ready=1
               break
             fi
             echo "Waiting for Redis... ($i/30)"
             sleep 2
           done
+          if [ "$ready" -ne 1 ]; then
+            echo "Redis did not become ready in time"
+            exit 1
+          fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/cd-internal-dev.yml around lines 21 - 47, The readiness
loops for MySQL ("Wait for MySQL to be ready") and Redis ("Wait for Redis to be
ready") currently break when ready but always continue on timeout; modify each
loop to detect timeout and explicitly fail the step (e.g., after the for loop
check a success flag or test the last ping, and if not ready run echo
"MySQL/Redis failed to start" and exit 1) so that payment-test-mysql (mysqladmin
ping -h localhost) and payment-test-redis (redis-cli ping | grep -q PONG)
timeouts cause the job to stop instead of proceeding to the "Test & Build" step.


- name: Sign in Dockerhub
uses: docker/login-action@v3
Expand All @@ -45,11 +54,9 @@ jobs:

- name: Build the Docker image
run: docker build -f ./Dockerfile --platform linux/amd64 --no-cache -t samhap/kokomen-payment-internal:dev .
working-directory: ./internal

- name: Push the Docker Image to Dockerhub
run: docker push samhap/kokomen-payment-internal:dev
working-directory: ./internal

deploy-internal:
needs: build-internal
Expand Down
47 changes: 27 additions & 20 deletions .github/workflows/cd-internal-prod.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CD INTERNAL PROD
name: CD PROD

on:
push:
Expand All @@ -18,24 +18,33 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Grant execute permission for run-test-mysql.sh
run: chmod +x run-test-mysql.sh
working-directory: ./domain
- name: Start test containers
run: docker compose -f test-docker-compose.yml up -d

- name: Grant execute permission for run-test-redis.sh
run: chmod +x run-test-redis.sh
working-directory: ./common

- name: Run test mysql script
run: ./run-test-mysql.sh
working-directory: ./domain

- name: Run test redis script
run: ./run-test-redis.sh
working-directory: ./common

- name: Test & Build internal only
run: ./gradlew :internal:build
- name: Wait for MySQL to be ready
run: |
for i in $(seq 1 30); do
if docker exec payment-test-mysql mysqladmin ping -h localhost --silent 2>/dev/null; then
echo "MySQL is ready"
break
fi
echo "Waiting for MySQL... ($i/30)"
sleep 2
done

- name: Wait for Redis to be ready
run: |
for i in $(seq 1 30); do
if docker exec payment-test-redis redis-cli ping 2>/dev/null | grep -q PONG; then
echo "Redis is ready"
break
fi
echo "Waiting for Redis... ($i/30)"
sleep 2
done

- name: Test & Build
run: ./gradlew build
Comment on lines +21 to +47
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

레디니스 타임아웃 후에도 성공으로 진행됨

현재 루프는 준비되지 않아도 종료 후 다음 단계로 진행합니다. 서비스가 기동되지 않은 상태에서 테스트/빌드 및 이미지 푸시가 수행될 수 있어 CI 신뢰성이 떨어집니다. 타임아웃 시 명시적으로 실패 처리하세요.

🛠️ 타임아웃 시 실패 처리 추가
       - name: Wait for MySQL to be ready
         run: |
-          for i in $(seq 1 30); do
+          ready=0
+          for i in $(seq 1 30); do
             if docker exec payment-test-mysql mysqladmin ping -h localhost --silent 2>/dev/null; then
               echo "MySQL is ready"
+              ready=1
               break
             fi
             echo "Waiting for MySQL... ($i/30)"
             sleep 2
           done
+          if [ "$ready" -ne 1 ]; then
+            echo "MySQL did not become ready in time"
+            exit 1
+          fi

       - name: Wait for Redis to be ready
         run: |
-          for i in $(seq 1 30); do
+          ready=0
+          for i in $(seq 1 30); do
             if docker exec payment-test-redis redis-cli ping 2>/dev/null | grep -q PONG; then
               echo "Redis is ready"
+              ready=1
               break
             fi
             echo "Waiting for Redis... ($i/30)"
             sleep 2
           done
+          if [ "$ready" -ne 1 ]; then
+            echo "Redis did not become ready in time"
+            exit 1
+          fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/cd-internal-prod.yml around lines 21 - 47, The readiness
loops for the "Wait for MySQL to be ready" and "Wait for Redis to be ready"
steps currently break on success but silently continue on timeout; modify each
loop so that if the loop completes without detecting readiness it prints a clear
error and exits non‑zero (e.g., echo "MySQL not ready after timeout" && exit 1
and similarly for Redis) so the subsequent "Test & Build" step fails instead of
proceeding when services never became ready.


- name: Sign in Dockerhub
uses: docker/login-action@v3
Expand All @@ -45,11 +54,9 @@ jobs:

- name: Build the Docker image
run: docker build -f ./Dockerfile --platform linux/arm64 --no-cache -t samhap/kokomen-payment-internal:prod .
working-directory: ./internal

- name: Push the Docker Image to Dockerhub
run: docker push samhap/kokomen-payment-internal:prod
working-directory: ./internal

deploy-internal:
needs: build-internal
Expand Down
58 changes: 0 additions & 58 deletions .github/workflows/ci-api-test.yml

This file was deleted.

Loading