Skip to content

Commit 7bd0366

Browse files
committed
[FEAT] CI/CD 파일 수정
1 parent 9adb30d commit 7bd0366

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,25 @@ jobs:
3333
3434
- name: Deploy to EC2
3535
run: |
36-
scp -i private_key.pem -o StrictHostKeyChecking=no \
37-
build/libs/*.jar ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}:/home/ubuntu/app.jar
36+
max_retries=3
37+
retry_count=0
3838
39-
ssh -i private_key.pem -o StrictHostKeyChecking=no \
39+
while [ $retry_count -lt $max_retries ]; do
40+
if scp -i private_key.pem -o StrictHostKeyChecking=no -o ConnectTimeout=10 \
41+
build/libs/*.jar ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}:/home/ubuntu/app.jar; then
42+
break
43+
fi
44+
retry_count=$((retry_count + 1))
45+
echo "SCP failed. Retrying ($retry_count/$max_retries)..."
46+
sleep 5
47+
done
48+
49+
if [ $retry_count -eq $max_retries ]; then
50+
echo "SCP failed after $max_retries attempts"
51+
exit 1
52+
fi
53+
54+
ssh -i private_key.pem -o StrictHostKeyChecking=no -o ConnectTimeout=10 \
4055
${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} << 'EOF'
4156
sudo systemctl restart studylink
4257
sudo systemctl status studylink

0 commit comments

Comments
 (0)