-
Notifications
You must be signed in to change notification settings - Fork 1
[CHORE] 운영용 CD 추가 #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CHORE] 운영용 CD 추가 #253
Conversation
Walkthrough프로덕션 환경 배포를 위한 새로운 GitHub Actions 워크플로우와 자동화 배포 스크립트가 추가되었습니다. 워크플로우는 release 브랜치로 병합된 PR이 닫힐 때 트리거되며, 배포, 헬스 체크, Slack 알림 순으로 세 가지 작업을 순차적으로 실행합니다. Changes
Sequence Diagram(s)sequenceDiagram
participant GitHub
participant Workflow
participant ProdServer
participant HealthCheck
participant Slack
GitHub->>Workflow: PR merge to release & close
Workflow->>ProdServer: SSH 접속 후 deploy-product.sh 실행
ProdServer-->>Workflow: 배포 완료
Workflow->>HealthCheck: 20초 대기 후 API 헬스 체크
HealthCheck-->>Workflow: 상태 코드 반환 (200/실패/타임아웃)
Workflow->>Slack: 배포 및 헬스 체크 결과 Slack 알림 전송
Possibly related PRs
Suggested reviewers
Poem
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (10)
eeos/scripts/deploy-product.sh (3)
5-7: Git 명령 실행 위치 보장
스크립트가eeos하위 디렉터리에서 호출될 때.git루트를 찾지 못할 수 있습니다.
명령 실행 전 항상 레포지토리 루트로 이동하도록 다음을 추가하세요:cd "$(git rev-parse --show-toplevel)"
8-8: Gradle 빌드 캐시·데몬 옵션 강화
./gradlew build -x test대신 깨끗한 빌드를 위해./gradlew clean build -x test --no-daemon옵션 사용을 고려하세요.
10-12: Docker Compose 배포 옵션 강화
컨테이너 잔여물 및 오프라인 이미지를 방지하려면 다음과 같은 플래그 추가를 권장합니다:-sudo docker-compose -f docker-compose-prod.yml down -sudo docker-compose -f docker-compose-prod.yml up --build -d +sudo docker-compose -f docker-compose-prod.yml down --remove-orphans +sudo docker-compose -f docker-compose-prod.yml up --build --force-recreate -d필요 시
docker-compose pull로 이미지 업데이트도 고려하세요..github/workflows/backend-cd-prod.yml (7)
1-7: 동시 배포 충돌 방지:concurrency도입 제안
여러 PR 병합 시 중복 배포를 막고자 workflow 최상단에 아래 설정을 추가하면 좋습니다.concurrency: group: 'deploy-${{ github.event.pull_request.base.ref }}' cancel-in-progress: false
15-20: SSH 액션 버전 및 인증 방식 검토
appleboy/[email protected]대신 커밋 SHA 고정 또는 최신 릴리즈 버전 사용을 고려하고, 가능하다면password대신 SSH 키 기반 인증(privateKey)으로 전환하여 보안 수준을 높이세요.
44-45: 하드코딩된 대기 시간 개선
20초고정 대기(sleep 20) 대신 재시도 루프나 readiness probe를 활용하여 컨테이너 준비 여부를 동적으로 확인하는 로직으로 대체하면 안정성이 향상됩니다.
46-49:curl실패 검증 및 변수 인용 강화
if [ $? -ne 0 ]대신if ! curl ...; then으로 직접 실패를 체크$GITHUB_OUTPUT는"$GITHUB_OUTPUT"로 이중 인용해 globbing/word splitting 방지- if [ $? -ne 0 ]; then + if ! curl -s -o /dev/null -w "%{http_code}" --max-time 10 "$HEALTH_URL"; then echo "status=timeout" >> "$GITHUB_OUTPUT"
45-45: API 엔드포인트 하드코딩 제거
헬스체크 URL을 직접 지정하기보다 workflowenv또는 repository secret으로 추출하여 유지보수성을 높이세요.
138-138: trailing spaces 제거
138행 끝에 trailing space가 포함되어 있습니다. 편집기나 lint 설정으로 자동 제거해 주세요.🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 138-138: trailing spaces
(trailing-spaces)
140-140: 파일 끝에 newline 추가
YAML 끝에 빈 줄을 한 줄 추가하여 POSIX 호환성과 린터 요구사항을 충족시키세요.🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 140-140: no new line character at the end of file
(new-line-at-end-of-file)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/backend-cd-prod.yml(1 hunks)eeos/scripts/deploy-product.sh(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/backend-cd-prod.yml
42-42: shellcheck reported issue in this script: SC2181:style:4:6: Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?
(shellcheck)
42-42: shellcheck reported issue in this script: SC2086:info:6:28: Double quote to prevent globbing and word splitting
(shellcheck)
42-42: shellcheck reported issue in this script: SC2086:info:8:28: Double quote to prevent globbing and word splitting
(shellcheck)
42-42: shellcheck reported issue in this script: SC2086:info:10:28: Double quote to prevent globbing and word splitting
(shellcheck)
🪛 YAMLlint (1.37.1)
.github/workflows/backend-cd-prod.yml
[error] 138-138: trailing spaces
(trailing-spaces)
[error] 140-140: no new line character at the end of file
(new-line-at-end-of-file)
| #!/bin/sh | ||
|
|
||
| set -ex | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
set -ex 대신 stricter 옵션 적용 제안
현재 set -ex 만 사용 중인데, undefined 변수나 파이프 실패를 잡지 못합니다.
-#!/bin/sh
-set -ex
+#!/usr/bin/env bash
+set -euxo pipefail를 적용하여 스크립트 안정성을 높이는 것을 권장합니다.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| #!/bin/sh | |
| set -ex | |
| #!/usr/bin/env bash | |
| set -euxo pipefail |
🤖 Prompt for AI Agents
In eeos/scripts/deploy-product.sh at lines 1 to 4, replace the current 'set -ex'
with stricter shell options by adding 'set -euo pipefail' to improve script
robustness. This change will make the script exit on errors, treat unset
variables as errors, and catch failures in pipelines, enhancing overall
stability.
|
|
||
| jobs: | ||
| deploy: | ||
| if: github.event.pull_request.merged == true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if 조건식 표현 오류
if: github.event.pull_request.merged == true 는 ${{ }} 없이는 항상 truthy 문자열로 평가됩니다.
if: ${{ github.event.pull_request.merged == true }}또는
if: ${{ github.event.pull_request.merged }}로 수정해야 의도대로 동작합니다.
🤖 Prompt for AI Agents
In .github/workflows/backend-cd-prod.yml at line 10, the if condition is missing
the required expression syntax and is treated as a string. Fix this by wrapping
the condition in ${{ }} like if: ${{ github.event.pull_request.merged == true }}
or simplify to if: ${{ github.event.pull_request.merged }} to ensure it
evaluates correctly.
📌 관련 이슈
#249
✒️ 작업 내용
스크린샷 🏞️ (선택)
💬 REVIEWER에게 요구사항 💬
Summary by CodeRabbit