Skip to content

Commit

Permalink
ci/cd: IS_BLUE_ENV 관련 잘 못된 경로 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Curry4182 committed Mar 20, 2024
1 parent 50a1bfc commit 2718293
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:

- name: Run Docker Container
run: |
PORT=${{ needs.setup-environment.outputs.IS_BLUE_ENV == 'true' && secrets.GREEN_PORT || secrets.BLUE_PORT }}
PORT=${{ needs.set-variable.outputs.IS_BLUE_ENV == 'true' && secrets.GREEN_PORT || secrets.BLUE_PORT }}
# 해당 포트에서 실행 중인 컨테이너 확인
RUNNING_CONTAINER=$(sudo docker ps --filter "status=running" --format '{{.ID}} {{.Ports}}' | grep ":$PORT->" | awk '{print $1}')
Expand All @@ -106,7 +106,7 @@ jobs:
id: test_response
continue-on-error: true
run: |
PORT=${{ needs.setup-environment.outputs.IS_BLUE_ENV == 'true' && secrets.GREEN_PORT || secrets.BLUE_PORT }}
PORT=${{ needs.set-variable.outputs.IS_BLUE_ENV == 'true' && secrets.GREEN_PORT || secrets.BLUE_PORT }}
success=false
for i in {1..12}; do # 최대 1분(120초) 동안 5초 간격으로 반복
response=$(curl -s http://localhost:$PORT/actuator || true)
Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:

- name: Run Docker Container
run: |
PORT=${{ needs.setup-environment.outputs.IS_BLUE_ENV == 'true' && secrets.GREEN_PORT || secrets.BLUE_PORT }}
PORT=${{ needs.set-variable.outputs.IS_BLUE_ENV == 'true' && secrets.GREEN_PORT || secrets.BLUE_PORT }}
RUNNING_CONTAINER=$(sudo docker ps --filter "status=running" --format '{{.ID}} {{.Ports}}' | grep ":$PORT->" | awk '{print $1}')
# 실행 중인 컨테이너가 있다면 중지
if [ ! -z "$RUNNING_CONTAINER" ]; then
Expand All @@ -164,7 +164,7 @@ jobs:
id: test_response
continue-on-error: true
run: |
PORT=${{ needs.setup-environment.outputs.IS_BLUE_ENV == 'true' && secrets.GREEN_PORT || secrets.BLUE_PORT }}
PORT=${{ needs.set-variable.outputs.IS_BLUE_ENV == 'true' && secrets.GREEN_PORT || secrets.BLUE_PORT }}
success=false
echo "Testing application response from /actuator on port $PORT..."
for i in {1..24}; do # 최대 1분(120초) 동안 5초 간격으로 반복
Expand Down Expand Up @@ -207,10 +207,10 @@ jobs:
needs.run-docker-image-on-server-2.outputs.passed == 'true'
steps:
- name: Switch to Green Environment
if: ${{ needs.setup-environment.outputs.IS_BLUE_ENV == 'true' }}
if: ${{ needs.set-variable.outputs.IS_BLUE_ENV == 'true' }}
run: sh /usr/local/bin/scripts/switch_to_green_env.sh

- name: Switch to Blue Environment
if: ${{ needs.setup-environment.outputs.IS_BLUE_ENV != 'true' }}
if: ${{ needs.set-variable.outputs.IS_BLUE_ENV != 'true' }}
run: sh /usr/local/bin/scripts/switch_to_blue_env.sh

0 comments on commit 2718293

Please sign in to comment.