C.W.K.
Stream
Lesson 12 of 13 · published

Rollback

~11 min · rollback, incident, recovery

Level 0Apprentice
0 XP0/101 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

Rollback 은 자기 workflow, 후순위 아냐

Rollback 옵션이 '이전 commit 다시 deploy' 뿐이면 사건 중에 이전 commit 의 image 가 사라졌고, migration 을 되돌릴 수 없고, 아무도 테스트 안 한 rollback 경로가 존재 안 한다는 걸 알게 돼. 필요하기 전 rollback workflow 빌드해.

Rollback 의 실제 의미

다른 deploy 타겟은 다른 rollback 모양:

  • Container 오케스트레이터 (ECS, Kubernetes) — 이전 task definition / deployment manifest 재-deploy. 가장 빠름.
  • 정적 사이트 (Vercel, Netlify, Pages) — 이전 deploy 승격. UI 버튼이나 API.
  • Lambda — 별칭을 이전 버전으로 가리킴.
  • Custom VPS deploy — symlink 스왑, git checkout <previous> 후 deploy 스크립트 재실행.

Rollback workflow

  • 마지막 10 deploy 에서 채워지는 input version: choice 가진 workflow_dispatch.
  • 또는: smoke job 의 if: failure() 로 자동 trigger.
  • 선택 버전 + 운영자와 함께 Slack/이메일 알림 게시.
  • Rollback 후 항상 smoke 실행 — rollback 자체 동작 검증.

Rollback 으로 못 고치는 것

  • 이미 적용된 schema 변경 — forward-fix migration 필요.
  • 이미 변경된 데이터 — 가능하면 point-in-time recovery, 아니면 손실 수용.
  • 이미 통지된 외부 시스템 (보낸 이메일, 청구된 결제) — un-happen 안 됨.

Code

수동 rollback workflow·yaml
name: rollback
on:
  workflow_dispatch:
    inputs:
      version:
        type: string
        required: true
        description: 'SHA or tag to roll back to (e.g., abc1234)'
      reason:
        type: string
        required: true
        description: 'Why are we rolling back?'

jobs:
  rollback:
    runs-on: ubuntu-latest
    environment: production
    permissions:
      id-token: write
      contents: read
    steps:
      - run: echo "Rolling back to ${{ inputs.version }} — reason: ${{ inputs.reason }}"
      - uses: aws-actions/configure-aws-credentials@v4
        with:
          role-to-assume: arn:aws:iam::123:role/gha-deploy-prod
          aws-region: us-east-1
      - run: ./deploy.sh ${{ inputs.version }}
      - run: ./tests/smoke.sh
      - name: Notify
        if: always()
        run: ./notify-slack.sh "Rollback to ${{ inputs.version }}: ${{ job.status }}"

External links

Exercise

서비스 하나에 수동 rollback workflow 빌드. 다음 주 30 분 staging 에서 테스트 일정. 처음 안 된 거 문서화.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.