슬롯 판정·전환을 infra 공용 블록 소비로 전환 - #30
Conversation
- 인라인 구현을 TeamPiKi/infra#38 의 블록 호출로 대체 (-56/+25줄). 판정·원복 로직의 정본이 infra 로 옮겨져 core 와 공유된다 (infra#37 3단계) - 값(슬롯 이름·포트·상태 파일·검증 명령)은 종전대로 이 호출부가 소유 - 블록 무값 원칙 - 이행 1회차 전용이던 레거시 단일 컨테이너 분기 제거 (2026-08-10 이행 완료로 도달 불가) - 부트스트랩(ACTIVE 빈 값) teardown 에 가드 추가 - 종전엔 빈 이름으로 no-op 호출이 나갔다 - 검증: 머지된 실제 블록으로 decide→eval→switch→verify(healthcheck 중첩 인용 포함) 로컬 통합 시뮬레이션 통과, yaml·bash -n·shellcheck 클린
📝 WalkthroughWalkthrough배포 워크플로가 슬롯 선택과 nginx 전환을 공용 스크립트로 위임합니다. 전환 실패 시 원복하고, 성공 시 기존 슬롯 컨테이너를 조건부로 정리합니다. Changes블루-그린 배포 전환
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant DeployWorkflow
participant slot_decide.sh
participant slot_switch.sh
participant nginx
DeployWorkflow->>slot_decide.sh: 상태 파일과 blue/green 슬롯 포트 전달
slot_decide.sh-->>DeployWorkflow: ACTIVE, INACTIVE, INACTIVE_PORT 반환
DeployWorkflow->>slot_switch.sh: 비활성 슬롯 전환 요청
slot_switch.sh->>nginx: upstream 갱신 및 설정 검증
nginx-->>slot_switch.sh: 전환 결과 반환
slot_switch.sh-->>DeployWorkflow: 성공 또는 원복 결과 반환
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 (1)
.github/workflows/deploy.yml (1)
165-167: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win
slot_decide.sh의 슬롯 이름을 검증하십시오.현재 호출부는
blue와green을 고정하므로 상태 파일을 통한 명령 주입은 발생하지 않습니다. 그러나slot_decide.sh는 슬롯 이름을 검증하거나 이스케이프하지 않습니다. 슬롯 인자를 변경할 수 있는 호출부가 추가되면eval "$DECIDED"가 명령 주입 경로가 됩니다. 슬롯 이름을 허용 목록으로 제한하거나eval을 제거하십시오.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/deploy.yml around lines 165 - 167, Validate slot names in slot_decide.sh against an explicit allowlist such as blue and green before generating DECIDED, or remove the eval "$DECIDED" execution path in the deployment workflow and use a non-evaluating result format. Ensure any future caller cannot turn slot arguments into shell commands.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/deploy.yml:
- Around line 205-207: restore() 원복 경로에서 nginx 설정을 먼저 nginx -t로 검증하고, 이후 reload
또는 restart의 성공 여부를 확인하십시오. 어느 단계든 실패하면 해당 오류를 무시하지 말고 nonzero를 반환하도록 하며, 원복 상태
파일을 적용한 뒤에도 실패가 호출자에게 전파되도록 수정하십시오.
---
Nitpick comments:
In @.github/workflows/deploy.yml:
- Around line 165-167: Validate slot names in slot_decide.sh against an explicit
allowlist such as blue and green before generating DECIDED, or remove the eval
"$DECIDED" execution path in the deployment workflow and use a non-evaluating
result format. Ensure any future caller cannot turn slot arguments into shell
commands.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0f38faa8-4141-4002-acbc-382ccffdefc6
📒 Files selected for processing (1)
.github/workflows/deploy.yml
Situation
Task
Action
slot_decide.sh --slot-a blue:18090 --slot-b green:18091호출 + "할당 후 eval" 소비로 대체 (블록 헤더가 정한 계약 - eval 직결은 치환 실패가 성공으로 위장).slot_switch.sh의 원복 경계 안으로 들어갔다. 검증 실패 시 새 슬롯 컨테이너 정리는 호출자에 남는다 (블록은 컨테이너를 모른다).Result
연관 이슈
Summary by CodeRabbit