From d8d4179098df994c784ee0c0c2b4a669822230f2 Mon Sep 17 00:00:00 2001 From: hyunseo Date: Fri, 8 Nov 2024 00:56:54 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20=ED=98=84=EC=9E=AC=EB=B2=84=EC=A0=84=20?= =?UTF-8?q?=ED=99=98=EA=B2=BD=EB=B3=80=EC=88=98=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/gradle.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index dce744ce..3914ff9b 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -86,7 +86,7 @@ jobs: # 다음 배포 버전을 결정 - name: Set next version run: | - if [[ "$CURRENT_VERSION" == "blue" ]]; then + if [[ "${{ env.current_version }}" == "blue" ]]; then NEXT_VERSION="green" PORT=8081 else @@ -100,9 +100,9 @@ jobs: # 기존의 동일한 컨테이너를 중지 (블루/그린 중 다음 배포 타겟에 해당하는 컨테이너) - name: Stop current docker container run: | - echo "Stopping container inplace-${{ env.NEXT_VERSION }}" - sudo docker stop inplace-${{ env.NEXT_VERSION }} || true - sudo docker rm inplace-${{ env.NEXT_VERSION }} || true + echo "Stopping container inplace-${{ env.next_version }}" + sudo docker stop inplace-${{ env.next_version }} || true + sudo docker rm inplace-${{ env.next_version }} || true # .env 파일 생성 - name: Create .env file @@ -113,15 +113,15 @@ jobs: # 다음 버전으로 새 컨테이너를 실행 - name: Run New Container on Next Version run: | - echo "Running new container inplace-${{ env.NEXT_VERSION }}" - sudo docker run --name "inplace-${{ env.NEXT_VERSION }}" --rm -d -p ${{ env.port }}:8080 --env-file .env ${{ secrets.DOCKERHUB_USERNAME }}/inplace + echo "Running new container inplace-${{ env.next_version }}" + sudo docker run --name "inplace-${{ env.next_version }}" --rm -d -p ${{ env.port }}:8080 --env-file .env ${{ secrets.DOCKERHUB_USERNAME }}/inplace # 로드 밸런서 타겟 그룹을 업데이트하여 트래픽을 새 컨테이너로 전환합니다. - name: Update Load Balancer Target Group run: | TARGET_GROUP_ARN_BLUE="${{ secrets.TARGET_GROUP_ARN_8080 }}" TARGET_GROUP_ARN_GREEN="${{ secrets.TARGET_GROUP_ARN_8081 }}" - if [[ "${{ env.NEXT_VERSION }}" == "blue" ]]; then + if [[ "${{ env.next_version }}" == "blue" ]]; then aws elbv2 modify-listener --listener-arn ${{ secrets.LISTENER_ARN_443 }} --default-actions Type=forward,TargetGroupArn=$TARGET_GROUP_ARN_BLUE else aws elbv2 modify-listener --listener-arn ${{ secrets.LISTENER_ARN_443 }} --default-actions Type=forward,TargetGroupArn=$TARGET_GROUP_ARN_GREEN @@ -129,7 +129,6 @@ jobs: # 이전 컨테이너 정리 - name: Remove previous docker container - if: env.CURRENT_VERSION != 'none' run: | if [[ "${{ env.CURRENT_VERSION }}" != "none" ]]; then echo "Removing previous container inplace-${{ env.CURRENT_VERSION }}"