Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Pull request overview
외부 SSH 포트를 열어두고 DB 서버에 직접 접속해 백업을 실행하던 배포 흐름을, GitHub OIDC + AWS Systems Manager Run Command 기반으로 전환해 DB 서버 인바운드 SSH 의존성을 줄이려는 PR입니다.
Changes:
- stage/prod 배포 워크플로우에 OIDC 사용을 위한
permissions: id-token: write추가 aws-actions/configure-aws-credentials로 AWS 자격 증명 설정 단계 추가- 배포 전 DB 백업을 SSH 실행 방식에서 SSM
send-command실행 방식으로 변경
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| .github/workflows/deploy-stage.yml | stage 배포 전 백업을 SSM Run Command로 실행하도록 변경 및 OIDC 권한/자격증명 설정 추가 |
| .github/workflows/deploy-prod.yml | prod 배포 전 백업을 SSM Run Command로 실행하도록 변경 및 OIDC 권한/자격증명 설정 추가 |
| - name: Backup stage MySQL before deploy | ||
| uses: appleboy/ssh-action@v1.2.0 | ||
| - name: Configure AWS credentials | ||
| uses: aws-actions/configure-aws-credentials@v4 |
There was a problem hiding this comment.
aws-actions/configure-aws-credentials가 다른 액션들과 달리 커밋 SHA로 고정되지 않고 @v4 태그를 사용하고 있어, 공급망(액션 하이재킹/변조) 리스크가 커집니다. 이 저장소의 다른 워크플로우처럼 해당 액션도 커밋 SHA로 pinning 해주세요.
| uses: aws-actions/configure-aws-credentials@v4 | |
| uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6b27e6f440bfd2d1b0c1c7f5f # v4 |
| aws ssm get-command-invocation \ | ||
| --command-id "$COMMAND_ID" \ | ||
| --instance-id "$DB_INSTANCE_ID" \ | ||
| --query "{Status:Status,Output:StandardOutputContent,Error:StandardErrorContent}" \ | ||
| --output json | ||
|
|
There was a problem hiding this comment.
get-command-invocation로 원격 백업 스크립트의 stdout/stderr를 그대로 Actions 로그에 출력하고 있습니다. backup-db.sh가 실패 시 환경변수/경로/계정 정보 등을 출력할 수 있으니, 로그에 남겨도 안전한 출력만 남기도록 스크립트 출력 정책을 보장하거나(예: 요약만 출력), 워크플로우에서 출력 내용을 필터링/축약하도록 조정하는 편이 안전합니다.
| aws ssm get-command-invocation \ | |
| --command-id "$COMMAND_ID" \ | |
| --instance-id "$DB_INSTANCE_ID" \ | |
| --query "{Status:Status,Output:StandardOutputContent,Error:StandardErrorContent}" \ | |
| --output json | |
| COMMAND_STATUS=$(aws ssm get-command-invocation \ | |
| --command-id "$COMMAND_ID" \ | |
| --instance-id "$DB_INSTANCE_ID" \ | |
| --query "Status" \ | |
| --output text) | |
| RESPONSE_CODE=$(aws ssm get-command-invocation \ | |
| --command-id "$COMMAND_ID" \ | |
| --instance-id "$DB_INSTANCE_ID" \ | |
| --query "ResponseCode" \ | |
| --output text) | |
| if [ "$COMMAND_STATUS" != "Success" ] || [ "$RESPONSE_CODE" != "0" ]; then | |
| echo "Stage MySQL backup failed. status=$COMMAND_STATUS, response_code=$RESPONSE_CODE" | |
| exit 1 | |
| fi | |
| echo "Stage MySQL backup completed successfully." |
| - name: Backup prod MySQL before deploy | ||
| uses: appleboy/ssh-action@v1.2.0 | ||
| - name: Configure AWS credentials | ||
| uses: aws-actions/configure-aws-credentials@v4 |
There was a problem hiding this comment.
aws-actions/configure-aws-credentials가 다른 액션들과 달리 커밋 SHA로 고정되지 않고 @v4 태그를 사용하고 있어, 공급망(액션 하이재킹/변조) 리스크가 커집니다. 이 저장소의 다른 워크플로우처럼 해당 액션도 커밋 SHA로 pinning 해주세요.
| uses: aws-actions/configure-aws-credentials@v4 | |
| uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6fc65e0e245d8c4b7f4a9b0b3 # v4 |
| aws ssm get-command-invocation \ | ||
| --command-id "$COMMAND_ID" \ | ||
| --instance-id "$DB_INSTANCE_ID" \ | ||
| --query "{Status:Status,Output:StandardOutputContent,Error:StandardErrorContent}" \ | ||
| --output json | ||
|
|
There was a problem hiding this comment.
get-command-invocation로 원격 백업 스크립트의 stdout/stderr를 그대로 Actions 로그에 출력하고 있습니다. backup-db.sh가 실패 시 환경변수/경로/계정 정보 등을 출력할 수 있으니, 로그에 남겨도 안전한 출력만 남기도록 스크립트 출력 정책을 보장하거나(예: 요약만 출력), 워크플로우에서 출력 내용을 필터링/축약하도록 조정하는 편이 안전합니다.
| aws ssm get-command-invocation \ | |
| --command-id "$COMMAND_ID" \ | |
| --instance-id "$DB_INSTANCE_ID" \ | |
| --query "{Status:Status,Output:StandardOutputContent,Error:StandardErrorContent}" \ | |
| --output json | |
| INVOCATION_SUMMARY=$(aws ssm get-command-invocation \ | |
| --command-id "$COMMAND_ID" \ | |
| --instance-id "$DB_INSTANCE_ID" \ | |
| --query "[Status,StatusDetails,ResponseCode]" \ | |
| --output text) | |
| read -r BACKUP_STATUS BACKUP_STATUS_DETAILS BACKUP_RESPONSE_CODE <<< "$INVOCATION_SUMMARY" | |
| echo "Backup command status: $BACKUP_STATUS (details: $BACKUP_STATUS_DETAILS, response-code: $BACKUP_RESPONSE_CODE)" | |
| if [ "$BACKUP_STATUS" != "Success" ]; then | |
| echo "Backup command failed. Detailed remote stdout/stderr is intentionally not printed to avoid leaking sensitive information." | |
| exit 1 | |
| fi |
🔍 개요
backup-db.sh를 SSM으로 실행하도록 변경해 DB 서버 인바운드 SSH 의존성을 줄입니다.🚀 주요 변경 내용
.github/workflows/deploy-stage.ymlid-token: write권한을 추가했습니다.aws-actions/configure-aws-credentials)를 추가했습니다..github/workflows/deploy-prod.ymlid-token: write권한을 추가했습니다.aws-actions/configure-aws-credentials)를 추가했습니다.💬 참고 사항
AWS_ROLE_TO_ASSUME,AWS_REGION,DB_INSTANCE_ID가 필요합니다.22222/TCP 0.0.0.0/0규칙을 제거할 수 있습니다./home/ubuntu/konect/prod-db-compose/backup-db.sh존재 여부와 실행 가능 여부를 배포 전 확인해야 합니다.✅ Checklist (완료 조건)