Skip to content

promote 에 dev→prod 직접 승격 옵션 추가 (staging 중단 대응) - #666

Merged
sevineleven merged 1 commit into
devfrom
infra/665-promote-dev-to-prod
Jul 3, 2026
Merged

promote 에 dev→prod 직접 승격 옵션 추가 (staging 중단 대응)#666
sevineleven merged 1 commit into
devfrom
infra/665-promote-dev-to-prod

Conversation

@sevineleven

@sevineleven sevineleven commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Situation

  • staging EC2 를 비용 절감으로 중단해둔 상태다. 그 동안 dev 의 변경을 prod 로 배포할 방법이 없다.
  • promote 는 실행 브랜치가 대상을 강제한다: dev→staging, staging→prod. dev→prod 직접 경로가 구조적으로 막혀 있다.

Task

  • staging 중단 기간에 dev→prod 직접 승격을 가능케 한다. 단 평소 dev→staging→prod 체인은 그대로 두고, 순서 뒤섞임으로 인한 사고를 막는다.

Action

  • workflow_dispatchto_prod boolean 입력 추가. dev 브랜치 + to_prod=true → dev→main(prod) 직접 승격 (S=dev·D=main·E=prod, prod 버전 bump 적용). 기본 false 라 평소 dev→staging 동작 유지.
  • ff-push·deploy dispatch 스텝은 원래 source/target·env 로 일반 처리돼 있어 dev→main 도 그대로 흐른다. 브랜치 강제 case 에 dev 분기(to_prod)만 더했다.
  • 헤더 주석에 예외 경로를 명시.

Result

  • 순서 안전성: promote 는 fast-forward 전용이라 dev 의 선형 히스토리를 앞으로만 옮긴다. dev→prod 를 먼저 해도, 나중에 staging 을 복구해 dev→staging→prod 를 타도 전부 ff 로 흡수된다 (main 이 staging 보다 앞선 적이 없어 non-ff 충돌이 없고, 이미 같으면 no-op skipped).
  • 용도: staging 중단 기간 한정. 복구되면 평소 dev→staging→prod 체인을 그대로 쓴다.

연관 이슈

Summary by CodeRabbit

  • New Features

    • 배포 승격 시 선택 옵션이 추가되어, 개발 환경에서 바로 프로덕션으로 승격할 수 있습니다.
    • 기본 흐름은 기존처럼 개발 → 스테이징이며, 스테이징 → 프로덕션 경로도 유지됩니다.
  • Bug Fixes

    • 허용되지 않은 실행 경로에 대한 오류 메시지를 더 명확하게 개선했습니다.

- staging EC2 중단 기간 동안 dev 변경을 prod 로 배포하려면 dev→staging→prod 체인을 못 타는 문제
- workflow_dispatch 에 to_prod boolean 입력 추가. dev 브랜치 + to_prod=true → dev→main(prod) 직접 승격(prod 버전 bump 적용). 기본 false 라 평소 dev→staging 유지
- ff-only 라 순서 안전: 나중 staging 복구 후 dev→staging→prod 도 전부 ff 로 흡수
@sevineleven sevineleven added the infra 운영 환경 (IaC·클라우드 리소스·secret·배포 workflow) label Jul 3, 2026
@sevineleven sevineleven self-assigned this Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Discord 스레드 연동용 메타데이터입니다. discord-pr-bot 워크플로가 자동 생성하며, 수정·삭제하면 PR 과 Discord 알림 연동이 끊깁니다.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

promote.yml 워크플로우에 workflow_dispatch 입력 to_prod(boolean, 기본 false)를 추가했습니다. dev 브랜치 실행 시 to_prod=true이면 staging을 건너뛰고 dev→main(prod)으로 직접 승격하며, 기존 dev→staging, staging→main(prod) 경로는 유지됩니다. 에러 메시지 문구도 갱신했습니다.

Changes

Promote 워크플로우 to_prod 옵션

Layer / File(s) Summary
to_prod 입력 정의 및 주석 추가
.github/workflows/promote.yml
workflow_dispatch에 to_prod boolean 입력(기본값 false)을 추가하고, staging 중단 시 dev→prod 직접 승격이 가능함을 설명하는 주석을 넣었습니다.
승격 경로 결정 로직 변경
.github/workflows/promote.yml
inputs.to_prodTO_PROD 환경변수로 주입하고, REF=dev이며 TO_PROD=true일 때 S=dev, D=main, E=prod로 전환하는 분기를 추가했으며, 기타 케이스 및 에러 메시지를 갱신했습니다.

Estimated code review effort: 2 (Simple) | ~10분

Sequence Diagram(s)

해당 없음(단일 워크플로우 파일 내 분기 로직 변경으로, 3개 이상의 독립 컴포넌트 상호작용이 없어 시퀀스 다이어그램 생성 조건에 부합하지 않습니다).

Assessment against linked issues

Objective Addressed Explanation
to_prod boolean 입력 추가, 기본값 false 유지 (#665)
dev 브랜치 + to_prod=true → dev→main(prod) 직접 승격 (#665)
staging 실행 시 to_prod 무시 (staging→prod 유지) (#665) 기존 staging 케이스 분기가 그대로 유지되어 TO_PROD 값과 무관하게 동작합니다.

요약: 로직 자체는 이슈 요구사항을 잘 따라가고 있네요, 짧고 굵게 👍. 다만 TO_PROD 값 비교 시 문자열 "true"/"false" 처리 방식이 셸 스크립트 특성상 실수하기 쉬운 부분이니, 워크플로우 조건문 관련해서는 GitHub Actions의 Contexts and expression syntax 문서를 참고해 boolean 비교 방식을 한번 더 점검해보시면 좋겠습니다.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch infra/665-promote-dev-to-prod

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.github/workflows/promote.yml (1)

54-61: 🩺 Stability & Availability | 🔵 Trivial

분기 로직 자체는 정확합니다 — 다만 "staging 검증 생략"을 프로세스로 막아두면 더 안전합니다.

case 분기와 ff-only(라인 122) 조합 덕분에 순서 안전성은 잘 지켜집니다. 직접 dev→main 후 staging 복구 시에도, dev는 항상 앞으로만 이동하므로 dev→staging으로 staging을 main 이상으로 끌어올린 뒤 staging→main이 fast-forward로 성공합니다. 되돌아오지 못하는 상황이 없다는 점, 설계가 깔끔하네요.

다만 이 경로는 staging 검증 단계를 건너뛰고 prod로 직행한다는 게 핵심 리스크입니다. to_prod=true가 실수로(또는 downtime 종료 후에도 습관적으로) 켜지면 검증되지 않은 dev 커밋이 그대로 prod에 배포됩니다. 코드로 조건을 더 거는 것보다, 운영 차원의 가드가 효과적입니다.

  • promote job(또는 최소한 prod 경로)에 GitHub Environment(environment: production)를 붙이고 required reviewers를 설정하면, to_prod=true 직행 시에도 최종 배포 전에 수동 승인 게이트가 한 번 걸립니다. staging 우회의 안전망으로 적합합니다.
  • 참고: Using environments for deployment

또한 직접 승격 직후 staging이 돌아온 첫 staging→main 실행은 staging이 main보다 뒤처져 있으면 non-ff(422)로 실패하며 실패 Discord 알림이 발송됩니다(설계상 안전한 차단이지만 알림 노이즈). 운영 노트나 안내 문구에 이 흐름을 한 줄 남겨두면 팀이 당황하지 않을 것 같습니다.

🤖 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/promote.yml around lines 54 - 61, The promote workflow
currently allows the dev-to-prod fast path when to_prod=true, which can bypass
staging validation. Update the promote job to use a protected GitHub Environment
for the production path, ideally by setting environment: production on the
relevant job or prod branch of the promote workflow. Configure required
reviewers or an approval gate so the direct dev→main route in promote.yml cannot
deploy without an explicit human check, while leaving the normal staging path
unchanged.

Source: Path instructions

🤖 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.

Nitpick comments:
In @.github/workflows/promote.yml:
- Around line 54-61: The promote workflow currently allows the dev-to-prod fast
path when to_prod=true, which can bypass staging validation. Update the promote
job to use a protected GitHub Environment for the production path, ideally by
setting environment: production on the relevant job or prod branch of the
promote workflow. Configure required reviewers or an approval gate so the direct
dev→main route in promote.yml cannot deploy without an explicit human check,
while leaving the normal staging path unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 0adf2d30-f9ab-4cdd-871f-b1604b4fb3e4

📥 Commits

Reviewing files that changed from the base of the PR and between 0d31808 and 2a1a74f.

📒 Files selected for processing (1)
  • .github/workflows/promote.yml

@github-actions
github-actions Bot requested a review from m-a-king July 3, 2026 06:04
@sevineleven
sevineleven merged commit d05ea43 into dev Jul 3, 2026
10 checks passed
@sevineleven
sevineleven deleted the infra/665-promote-dev-to-prod branch July 3, 2026 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infra 운영 환경 (IaC·클라우드 리소스·secret·배포 workflow)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

promote 에 dev→prod 직접 승격 옵션 추가 (staging 중단 대응)

1 participant