Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 0 additions & 119 deletions .github/workflows/ci.yml

This file was deleted.

52 changes: 0 additions & 52 deletions .github/workflows/upstream-watch.yml

This file was deleted.

63 changes: 63 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Local 4-tier gate (RFC 0002 — GH Actions 영구 금지). ADR 0009 참조.
#
# 도입:
# pre-commit install --hook-type pre-commit --hook-type pre-push
#
# 우회:
# `--no-verify`는 사고 보고 의무 (incident-kb.md). 남용 금지.
#
# 매핑:
# L1 pre-commit — lint (빠른 피드백)
# L2 pre-push — test (unit + envtest), audit (trivy fs), secrets (gitleaks),
# go.mod drift check
# L3 Makefile — e2e (kind), matrix-build (docker buildx) — 수동 실행
# L4 PR review — PR body의 "로컬 게이트 PASS" 증거 블록 확인

repos:
- repo: local
hooks:
# ================================================================
# L1 pre-commit — fast feedback (< 30s 목표)
# ================================================================
- id: golangci-lint
name: golangci-lint (with .custom-gcl)
language: system
entry: bash -c 'make lint-config && make lint'
pass_filenames: false
always_run: true
stages: [pre-commit]

# ================================================================
# L2 pre-push — comprehensive verification (1-3 min 목표)
# ================================================================
- id: go-mod-tidy-drift
name: go.mod / go.sum drift check
language: system
entry: bash -c 'go mod tidy && git diff --exit-code go.mod go.sum'
pass_filenames: false
always_run: true
stages: [pre-push]

- id: go-test
name: Unit + envtest (make test)
language: system
entry: make test
pass_filenames: false
always_run: true
stages: [pre-push]

- id: trivy-fs-audit
name: Trivy fs (HIGH+CRITICAL — make audit)
language: system
entry: make audit
pass_filenames: false
always_run: true
stages: [pre-push]

- id: gitleaks
name: gitleaks (staged secrets scan)
language: system
entry: bash -c 'command -v gitleaks >/dev/null 2>&1 && gitleaks protect --staged --redact || { echo "[warn] gitleaks 미설치 — brew install gitleaks 권장"; exit 0; }'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Fail pre-push when gitleaks actually finds secrets

The gitleaks hook currently uses command -v ... && gitleaks ... || { ...; exit 0; }, which means any non-zero exit from gitleaks protect (including real secret detections) falls into the || branch and returns success, so pushes are not blocked even when secrets are found. In this repo, CI workflows were removed in the same commit, so this effectively disables secret-enforcement for contributors who do have gitleaks installed.

Useful? React with 👍 / 👎.

pass_filenames: false
always_run: true
stages: [pre-push]
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
lint-config: golangci-lint ## Verify golangci-lint linter configuration
"$(GOLANGCI_LINT)" config verify

.PHONY: audit
audit: ## Run vulnerability scan (trivy fs, HIGH+CRITICAL severity, ignore-unfixed). RFC 0002 / ADR 0009.
@command -v trivy >/dev/null 2>&1 || { echo "[error] trivy not installed: brew install trivy (or apt install trivy)"; exit 1; }
trivy fs --severity HIGH,CRITICAL --exit-code 1 --ignore-unfixed --skip-dirs vendor,bin,tmp .

##@ Build

.PHONY: build
Expand Down
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,47 @@ psql "host=localhost port=5432 dbname=app user=app sslmode=require"

---

## Development (로컬 게이트)

본 프로젝트는 [ADR 0009](docs/adr/0009-no-github-actions-rfc-0002.md)에 따라 **GitHub Actions를 사용하지 않습니다** (글로벌 RFC 0002, 2026-04-29 사고 트리거). 모든 게이트(lint·test·audit·secrets)는 *로컬 4 계층*으로 일원화됐습니다.

### 1회 셋업

```bash
# 보안 도구 설치 (macOS)
brew install gitleaks trivy
# Linux는 apt/공식 binary 참조: https://aquasecurity.github.io/trivy/

# pre-commit hook 활성화 (1회 실행)
pip install pre-commit # 또는 brew install pre-commit
pre-commit install --hook-type pre-commit --hook-type pre-push
```

### 4 계층 게이트

| 계층 | 시점 | 명령 | 차단 기준 |
|---|---|---|---|
| **L1 pre-commit** | `git commit` | `make lint` | lint error 1건 이상 |
| **L2 pre-push** | `git push` | `make test`, `make audit`, gitleaks, go.mod drift | error 1건 이상 |
| **L3 Makefile** | 개발자 수시 | `make test-e2e` (kind 7-9분), `make build` | 로컬 명시 검증 |
| **L4 PR review** | merge 전 | PR body의 "로컬 게이트 PASS" 증거 블록 | 증거 부재 시 머지 차단 |

### PR 머지 증거 블록 (필수)

PR 본문 또는 첫 commit 메시지에 다음 형식 포함 (`standards/ci.md §2`):

```
로컬 게이트 PASS:
- pre-commit run --all-files: PASS
- pre-push hooks: PASS
- make test: PASS
- make audit: PASS (HIGH+CRITICAL = 0)
```

부재 시 리뷰어가 머지를 차단합니다. 우회(`--no-verify`)는 사고 보고 의무 (`incident-kb.md`).

---

## 기여하기

- 행동강령: [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) (Contributor Covenant 2.1)
Expand Down
Loading