Skip to content

Commit

Permalink
reafactor: CD 배포 스크립트 구문 수정
Browse files Browse the repository at this point in the history
더 정확하게
  • Loading branch information
kanguk01 committed Nov 1, 2024
1 parent 3c4bdd8 commit c80fdda
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on:
branches:
- develop
- feat/96-feature-bluegreen

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -32,7 +32,7 @@ jobs:
- name: Decode env.properties from GitHub Secrets
run: |
echo "${{ secrets.ENV_FILE }}" | base64 --decode > ./env.properties
- name: Decode Firebase config from GitHub Secrets
run: |
echo "${{ secrets.FIREBASE_CONFIG }}" | base64 --decode > ./splanet-firebase.json
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
username: ubuntu
key: ${{ secrets.EC2_SSH_KEY }}
script: |
if [ "${steps.current_version.outputs.version}" == "blue" ]; then
if [ "${{ steps.current_version.outputs.version }}" == "blue" ]; then
NEW_VERSION="green"
NEW_PORT=8081
else
Expand All @@ -102,12 +102,14 @@ jobs:
username: ubuntu
key: ${{ secrets.EC2_SSH_KEY }}
script: |
if [ "${steps.current_version.outputs.version}" == "blue" ]; then
if [ "${{ steps.current_version.outputs.version }}" == "blue" ]; then
NEW_VERSION="green"
NEW_PORT=8081
else
NEW_VERSION="blue"
NEW_PORT=8080
fi
echo "Waiting for the application to be healthy on http://api.splanet.co.kr:${NEW_PORT}/actuator/health..."
for i in {1..30}; do
if curl -s http://api.splanet.co.kr:${NEW_PORT}/actuator/health | grep '"status":"UP"' > /dev/null; then
Expand All @@ -117,8 +119,7 @@ jobs:
echo "Waiting for application to start... (Attempt $i)"
sleep 5
done
# If the application is not healthy after 40 attempts (200 seconds), fail the deployment
if [ "$i" -eq 30 ]; then
echo "Application did not start successfully within the expected time."
sudo docker logs splanet_${NEW_VERSION}
Expand Down Expand Up @@ -152,7 +153,6 @@ jobs:
sudo docker rm splanet_${{ steps.current_version.outputs.version }}
fi
- name: Clean up old Docker images
uses: appleboy/[email protected]
with:
Expand Down

0 comments on commit c80fdda

Please sign in to comment.