Skip to content

ci: GitHub 인프라 장애·stale submission 브랜치 재발 방지#206

Merged
orientpine merged 3 commits into
masterfrom
ci/infra-resilience
Apr 26, 2026
Merged

ci: GitHub 인프라 장애·stale submission 브랜치 재발 방지#206
orientpine merged 3 commits into
masterfrom
ci/infra-resilience

Conversation

@orientpine
Copy link
Copy Markdown
Owner

배경

PR #193(issue #192 'hwp/hwpx 에디터')의 CI가 실패해 머지가 차단됐던 사건에서 두 개의 독립된 실패 원인을 발견했다. 첫 번째는 GitHub 인프라 일시 장애(HTTP 500), 두 번째는 그 와중에 노출된 process-submission.yml의 stale 브랜치 재사용 버그다.

변경 내용

1. process-submission.yml 강화 — non-fast-forward 방지

Create PR with new submission 스텝에서 git push origin "$BRANCH"만 했던 것을 다음으로 교체:

  • 같은 브랜치에 열린 PR이 있으면 브랜치를 건드리지 않고 --force-with-lease로 새 commit을 덮어쓴다 (기존 PR이 update 됨).
  • 열린 PR이 없는데 stale 원격 브랜치만 남아있으면 먼저 삭제 후 push.
  • git fetch origin "$BRANCH" || true--force-with-lease 비교 기준을 확보.
  • PR 생성은 open PR이 없을 때만 (있으면 재사용 메시지 출력).

2. ci-auto-rerun.yml 신규 — infra-transient 자동 재실행

  • Trigger: workflow_run on CI completed
  • Condition: conclusion == 'failure' && run_attempt < 3 (loop 차단)
  • 실패 로그(`gh run view --log-failed`)에서 infra-transient 시그니처(HTTP 5xx, ETIMEDOUT, ENOTFOUND, RPC failed 등)가 매칭될 때만 `gh run rerun --failed`
  • 결정적 실패(테스트/빌드 오류)는 자동 재실행하지 않음 — 같은 결과를 반복할 뿐이라 리소스 낭비

로컬에서 4개 골든 로그 샘플로 단위 검증 완료:

  • 실제 24846153285의 infra 로그 → MATCH ✅
  • Jest 테스트 실패 로그 → NO_MATCH ✅
  • TypeScript compile 오류 로그 → NO_MATCH ✅
  • Connect Timeout 로그 → MATCH ✅

3. docs/troubleshooting/rss-submission-ci-failure.md 신규

증상·원인·해결·예방 조치를 모두 기록.

검증

bun run validate                          → ✅ 465 files
bun run validate:docs                     → ✅ 72 files
bun run validate:docs -- --check-coverage → ✅ pass
bun run build                             → ✅ 967 pages
bun run test                              → ✅ 375 tests

즉시 효과

  • PR Submission from issue #192 #193 자체는 `gh run rerun 24846153285 --failed`로 이미 복구되어 머지 가능 상태.
  • 본 PR이 머지된 이후의 CI 실패는 인프라 장애일 경우 자동 재실행됨.
  • 같은 issue를 재처리해도 stale 브랜치 때문에 fail 하지 않음.

비범위

  • ci.yml 자체는 수정하지 않음 (nick-fields/retry로 step-level wrap은 효과 적음 — 장애가 checkout 단계라).
  • process-submission.yml의 `Auto-merge if editor` 스텝은 그대로 유지 (`--delete-branch` 추가는 별도 개선 기회).

Closes-related: PR #193 (이미 단순 rerun으로 복구)

submission/<N> 브랜치가 이전 run 잔재로 원격에 남아 있을 때
git push가 non-fast-forward로 거부되며 워크플로우가 실패하던 문제를 해결한다.

변경:
- 열린 PR이 없을 때만 stale 원격 브랜치를 정리 (PR이 있으면 손대지 않음)
- git fetch origin $BRANCH 후 --force-with-lease로 push (경쟁 상태 감지)
- 이미 열린 PR이 있으면 gh pr create 대신 재사용

영향:
- 같은 issue 재트리거(workflow_dispatch, 재라벨링)에서도 안정 동작
- PR 본문이 자동 생성이고 단일 commit이므로 force-with-lease 안전

관련 문서: docs/troubleshooting/rss-submission-ci-failure.md
actions/checkout이 HTTP 500/502/503/504 또는 connection timeout 등
GitHub 쪽 일시 장애로 retry를 소진하고 실패하면, 새 워크플로우가
실패 로그에서 infra-transient 시그니처를 확인 후 gh run rerun --failed로
자동 재실행한다.

핵심 동작:
- workflow_run on CI completed (failure만)
- run_attempt < 3 으로 무한 루프 차단
- gh run view --log-failed 로그를 시그니처 매칭
  (HTTP 5xx, RPC failed, ETIMEDOUT, ENOTFOUND github.com 등)
- 매칭 안 되면 아무 것도 안 함 (테스트/빌드 실패 같은 결정적 실패는 재실행 안 함)
- permissions: actions: write, contents: read

로컬 단위 검증: 4개 골든 로그 샘플 모두 기대대로 분류
  · 실제 24846153285 infra 로그 → MATCH
  · jest test failure 로그       → NO_MATCH
  · TS compile error 로그         → NO_MATCH
  · Connect Timeout 로그          → MATCH

관련 문서: docs/troubleshooting/rss-submission-ci-failure.md
PR #193 (issue #192 'hwp/hwpx 에디터')에서 발생한 두 개의 독립적
실패 원인을 정리하고, 적용한 수정의 동기와 디자인 결정을 남긴다.

다룬 내용:
- 원인 1: GitHub 인프라 일시 장애 (actions/checkout retry 소진)
- 원인 2: stale submission/<N> 브랜치 재사용 (non-fast-forward)
- 해결: ci-auto-rerun.yml + process-submission.yml force-with-lease 로직
- 시그니처 매칭 정책 (false positive 방지)

관련 워크플로우:
- .github/workflows/process-submission.yml
- .github/workflows/ci-auto-rerun.yml
@orientpine orientpine enabled auto-merge (squash) April 26, 2026 12:16
@orientpine orientpine merged commit 623a30f into master Apr 26, 2026
3 checks passed
@orientpine orientpine deleted the ci/infra-resilience branch April 26, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant