Conversation
|
Caution Review failedThe pull request is closed. Walkthrough백엔드 CI/CD 워크플로우들을 로컬 실행에서 SSH 원격 실행으로 전환하고, 프로덕션 앱 CD 워크플로우를 삭제하며 CI 트리거와 job 구조를 단순화했습니다. (50자 이내) Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant GHA as GitHub Actions
participant SSHAction as appleboy/ssh-action
participant Remote as Remote Server
rect rgba(220,235,255,0.5)
Note over GHA,SSHAction: SSH 기반 원격 배포 흐름
GHA->>SSHAction: 워크플로우 실행 및 시크릿 전달
SSHAction->>Remote: SSH 접속 및 원격 배포 스크립트 실행
Remote->>Remote: 이미지 풀, 원격 .env 생성/갱신, docker compose up, 이미지 정리, 헬스체크 반복
Remote-->>SSHAction: 로그와 종료 코드 반환
SSHAction-->>GHA: 실행 결과 보고 (성공/실패)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.github/workflows/backend-prod-cd.yml (2)
60-69: 배포 성공 검증 및 에러 처리 부족원격 배포 스크립트 실행 후 성공/실패 여부를 검증하거나 로깅하는 단계가 없습니다. 다음을 추가하는 것을 고려하세요:
- 배포 결과 확인:
deploy.sh스크립트가 실패할 경우 워크플로우에서 감지할 수 있는지 확인- 타임아웃 설정: SSH 연결이 무한 대기하지 않도록 타임아웃 추가 (현재: 미지정)
- 스크립트 검증: 배포 스크립트가 이미 적절한 에러 처리를 포함하고 있는지 확인
예시 개선:
- name: SSH로 배포 스크립트 실행 uses: appleboy/ssh-action@v1.0.0 with: host: ${{ secrets.PROD_SERVER_HOST }} username: ubuntu key: ${{ secrets.SSH_PRIVATE_KEY }} script_stop: true command_timeout: 10m script: | cd /home/ubuntu/coursepick ./deploy.sh || exit 1
65-65: SSH 사용자명을 환경 변수로 관리SSH 사용자명
ubuntu가 하드코딩되어 있습니다. 이를 secret으로 관리하면 서버 구성 변경 시 유연성이 높아집니다:username: ${{ secrets.SSH_USERNAME }}필요에 따라
SSH_USERNAMEsecret을 생성하세요.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/backend-prod-app-cd.yml(0 hunks).github/workflows/backend-prod-cd.yml(2 hunks)
💤 Files with no reviewable changes (1)
- .github/workflows/backend-prod-app-cd.yml
🔇 Additional comments (2)
.github/workflows/backend-prod-cd.yml (2)
47-53: Docker 이미지 빌드와 배포 스크립트의 중복 여부 확인
build잡에서 Docker 이미지를 빌드하고 레지스트리에 푸시하는 동안,deploy잡의./deploy.sh스크립트도 유사한 작업을 수행할 수 있습니다. 배포 스크립트의 내용을 확인하여 다음을 검증하세요:
- 배포 스크립트가 이미 Docker 이미지를 레지스트리에서 가져오는지 여부
- 불필요한 중복 빌드가 있는지 여부
- 빌드 단계의 필요성과 효율성
프로덕션 워크플로우의 효율성을 위해 확인해주세요.
4-5: I'll help you verify the review comment about the workflow trigger change. Let me examine the workflow file and understand its context.
<function_calls>
#!/bin/bashFirst, read the full workflow file to understand context
cat -n .github/workflows/backend-prod-cd.yml
</function_calls>Now let me check if there are other similar workflow files to compare the deployment strategy:
<function_calls>
#!/bin/bashList all workflow files to understand the deployment strategy
fd -e yml -e yaml .github/workflows/ | sort
</function_calls>Let me also check the git history of this file to understand what changed:
<function_calls>
#!/bin/bashCheck recent changes to this workflow file
git log --oneline -10 .github/workflows/backend-prod-cd.yml 2>/dev/null || echo "Git history not available"
</function_calls>Let me get the diff to see what actually changed in this PR:
<function_calls>
#!/bin/bashShow the diff for this file in the current PR
git diff HEAD^ .github/workflows/backend-prod-cd.yml 2>/dev/null || git diff .github/workflows/backend-prod-cd.yml 2>/dev/null || echo "Git diff not available"
</function_calls>Let me check the repository structure to understand the branch strategy:
<function_calls>
#!/bin/bashCheck if there's documentation about deployment strategy
cat README.md 2>/dev/null | head -100
echo "---"Check for any deployment or CI docs
fd -e md . .github/ | head -20
</function_calls>
dompoo
left a comment
There was a problem hiding this comment.
배포 스크립트를 수정하고 싶으면 결국 ec2 내부로 들어가야 하는게 단점 같아요.
github action 수준에서 그냥 모든 작업을 수행하게 해주는 것도 좋을 것 같고,
아니면 github의 배포 스크립트를 ssh로 복붙한 후에, 실행시키면 동적으로 스크립트 수정도 가능할 것 같은데 어떠신가요?
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
.github/workflows/backend-dev-cd.yml (1)
46-51:⚠️ SSH 배포 에러 처리 누락:script_stop: true필수 추가현재 SSH 액션 설정에는 에러 처리 플래그가 없어서, 배포 스크립트 실패 시에도 워크플로우 스텝이 성공으로 표시될 수 있습니다.
script_stop: true를 추가하여 스크립트 오류 시 즉시 중단하도록 설정해야 합니다.- name: SSH로 배포 스크립트 실행 uses: appleboy/ssh-action@v1.0.0 with: host: ${{ secrets.DEV_SERVER_HOST }} username: ubuntu key: ${{ secrets.SSH_PRIVATE_KEY }} + script_stop: true script: |또한 스크립트 내부에서도 에러 발생 시 즉시 실패하도록
set -e또는set -o pipefail을 추가 권장:script: | set -e # 또는 set -o pipefail cd /home/ubuntu/coursepick ...
🧹 Nitpick comments (1)
.github/workflows/backend-prod-cd.yml (1)
55-69: 프로덕션 배포 후 헬스 체크 추가 권장개발 서버 배포에는
/actuator/health엔드포인트를 통한 헬스 체크 로직이 있으나, 프로덕션 배포에는 배포 후 서버 상태를 검증하는 단계가 없습니다. 배포 성공을 확인하기 위해 다음과 같이 별도 스텝을 추가하거나, 원격 서버의deploy.sh에 포함시키기를 권장합니다:- name: 배포 후 헬스 체크 run: | for i in $(seq 1 10); do HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://${{ secrets.PROD_SERVER_HOST }}/actuator/health || echo "000") if [ "$HTTP_CODE" -eq 200 ]; then echo "✅ 프로덕션 배포 성공" exit 0 fi echo "시도 $i/10: 헬스 체크 실패 (HTTP $HTTP_CODE). 5초 후 재시도..." sleep 5 done echo "❌ 배포 실패: 서버 응답 없음" exit 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/backend-dev-cd.yml(2 hunks).github/workflows/backend-prod-cd.yml(2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.9)
.github/workflows/backend-dev-cd.yml
11-11: error while parsing reusable workflow "./.github/workflows/backend-ci.yml": "workflow_call" event trigger is not found in "on:" at line:4, column:3
(workflow-call)
🔇 Additional comments (1)
.github/workflows/backend-prod-cd.yml (1)
55-69: I'll help you verify the review comment about the production deployment workflow. Let me start by investigating the key concerns.
<function_calls>
appleboy/ssh-action v1.0.0 script_stop parameter documentation
</function_calls>I also need to check the repository for the deploy.sh script and understand the workflow better:
<function_calls>
Check if deploy.sh exists and examine the workflow file
fd -type f -name "deploy.sh" | head -20
</function_calls><function_calls>
Read the complete workflow file to understand context
cat -n .github/workflows/backend-prod-cd.yml 2>/dev/null || echo "File not found"
</function_calls><function_calls>
appleboy ssh-action github action error handling script failure
</function_calls>Please wait while I gather information to verify the concerns raised in this review comment.
|
@dompoo 맞는 말입니다~ 수정했어요! 기존 스크립트 로직과 동일하게 구성했습니다. |
d80f31d to
ca1736d
Compare
* chore: dev 서버 스크립트 변경 * chore: 테스트를 위해 바꾼 조건 재변경 * chore: prod cd 스크립트 수정 * fix: cd 스크립트 픽스 * refactor: 배포 스크립트 girhub actions script로 통일 * refactor: 배포 과정에서 CI 과정 ci 스크립트로 수행하도록 변경 * refactor: env 파일 생성 과정 추가 * chore: prod 테스트를 위한 조건 원복 * chore: 개발 서버 배포 테스트를 위한 조건 변경 * refactor: ci/cd 과정 분리 * fix: build 문제 해결 * refactor: ci 과정과 네이밍 통합 * refactor: 테스트를 위해 설정한 조건 복원 * refactor: 운영서버 스크립트 수정 * refactor: 운영서버 브랜치 수정 * test: 운영 서버 테스트 * refactor: 테스트를 위한 조건 복원
* chore: dev 서버 스크립트 변경 * chore: 테스트를 위해 바꾼 조건 재변경 * chore: prod cd 스크립트 수정 * fix: cd 스크립트 픽스 * refactor: 배포 스크립트 girhub actions script로 통일 * refactor: 배포 과정에서 CI 과정 ci 스크립트로 수행하도록 변경 * refactor: env 파일 생성 과정 추가 * chore: prod 테스트를 위한 조건 원복 * chore: 개발 서버 배포 테스트를 위한 조건 변경 * refactor: ci/cd 과정 분리 * fix: build 문제 해결 * refactor: ci 과정과 네이밍 통합 * refactor: 테스트를 위해 설정한 조건 복원 * refactor: 운영서버 스크립트 수정 * refactor: 운영서버 브랜치 수정 * test: 운영 서버 테스트 * refactor: 테스트를 위한 조건 복원
🛠️ 주요 변경 사항
🔗 관련 이슈
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.