[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -1,77 +1,163 @@
|
||||
---
|
||||
id: wiki-2026-0508-ci-cd-pipeline
|
||||
title: CI CD Pipeline
|
||||
category: DevOps_and_Security
|
||||
status: needs_review
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [ci_cd_pipeline]
|
||||
aliases: [Continuous Integration / Delivery Pipeline, Build Pipeline]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.95
|
||||
tags: [- ci_cd - devops - automation - pipeline - software_delivery]
|
||||
raw_sources: ["- Programming & Language/CI_CD Pipeline.md - Programming & Language/CI_CD 파이프라인 자동화.md - Programming & Language/CI_CD 파이프라인.md - Programming & Language/Continuous Integration (CI).md - Architecture/CI_CD.md"]
|
||||
last_reinforced: 2026-05-08
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [ci, cd, devops, pipeline]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: applied
|
||||
tech_stack:
|
||||
language: YAML
|
||||
framework: GitHub Actions/GitLab CI/Buildkite
|
||||
---
|
||||
|
||||
# CI/CD 파이프라인 (Continuous Integration & Continuous Deployment)
|
||||
# CI CD Pipeline
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
CI/CD는 애플리케이션 개발 단계부터 배포까지의 전 과정을 자동화하여 사용자에게 더 빠르고 빈번하게 소프트웨어를 제공하는 방법론입니다 [1]. **CI(Continuous Integration)**는 코드 변경 사항을 정기적으로 빌드 및 테스트하여 공유 저장소에 병합하는 과정을, **CD(Continuous Delivery/Deployment)**는 검증된 코드를 운영 환경에 자동으로 배포하는 과정을 의미합니다 [1, 2].
|
||||
## 매 한 줄
|
||||
> **"매 commit 이 production 까지 도달하는 자동 경로가 CI/CD pipeline."**. Pipeline 은 build → test → security → package → deploy → verify 의 매 ordered DAG. 2026 의 표준: GitHub Actions reusable workflow + OIDC 기반 cloud auth + supply-chain attestation (SLSA L3) + progressive delivery (Argo Rollouts/Flagger).
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
### 1. 지속적 통합 (Continuous Integration, CI)
|
||||
* **자동 빌드 및 테스트**: 개발자가 코드를 커밋하면 자동으로 빌드가 수행되고 단위 테스트(Unit Test)가 실행됩니다.
|
||||
* **충돌 조기 발견**: 빈번한 병합을 통해 코드 간의 충돌을 조기에 발견하고 해결합니다.
|
||||
* **품질 게이트**: 정적 분석(SAST)이나 코드 품질 검사를 CI 단계에 포함시켜 기준 미달의 코드가 병합되는 것을 방지합니다.
|
||||
## 매 핵심
|
||||
|
||||
### 2. 지속적 제공 및 배포 (Continuous Delivery/Deployment, CD)
|
||||
* **Continuous Delivery**: CI 단계를 거친 아티팩트를 스테이징 환경까지 자동으로 배포하며, 운영 환경 배포는 수동 승인을 거칩니다.
|
||||
* **Continuous Deployment**: 모든 테스트를 통과한 코드를 운영 환경까지 어떠한 수동 개입 없이 자동으로 배포합니다 [2].
|
||||
* **배포 전략**: Blue-Green, Canary, Rolling Update 등을 활용하여 서비스 중단 없이 안전하게 배포합니다.
|
||||
### 매 Pipeline Stage
|
||||
1. **Source**: trigger on PR / push / tag.
|
||||
2. **Build**: deterministic, hermetic — Bazel/Nx cache.
|
||||
3. **Test**: unit / integration / e2e — parallel shards.
|
||||
4. **Security**: SAST (Semgrep), SCA (Trivy), secret scan.
|
||||
5. **Package**: container, helm chart, npm — sign (cosign).
|
||||
6. **Attest**: SBOM (Syft) + SLSA provenance.
|
||||
7. **Deploy**: env-progressive (dev → staging → prod).
|
||||
8. **Verify**: smoke, canary metrics, auto-rollback.
|
||||
|
||||
### 3. 파이프라인 구성 요소
|
||||
* **Source**: Git 등 버전 관리 시스템에서의 이벤트 감지.
|
||||
* **Build**: 소스 코드를 컴파일하고 실행 가능한 형태로 변환.
|
||||
* **Test**: 단위, 통합, 보안 테스트 수행.
|
||||
* **Deploy**: 타겟 환경(Cloud, On-premise 등)으로 배포 및 환경 설정.
|
||||
### 매 Modern Best Practices 2026
|
||||
- **OIDC over long-lived secrets** (GitHub OIDC → AWS/GCP).
|
||||
- **Reusable workflows** — DRY across repos.
|
||||
- **Matrix sharding** — test parallelism.
|
||||
- **Cache layers** — Turborepo, Nx, Bazel remote cache.
|
||||
- **Progressive delivery** — canary, blue/green, feature flags.
|
||||
- **GitOps** — Argo CD / Flux — git as source of truth.
|
||||
- **Supply chain** — Sigstore cosign, SLSA L3 attestation.
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
* **인프라 복잡성**: 자동화된 파이프라인을 구축하고 유지 관리하는 데 초기 비용과 노력이 많이 듭니다.
|
||||
* **테스트 신뢰성**: 자동화된 테스트의 품질이 낮으면 잘못된 코드가 자동으로 배포되어 서비스 장애를 유발할 수 있습니다.
|
||||
* **보안 리스크**: 파이프라인 자체의 보안(Secrets management 등)이 뚫리면 악성 코드가 배포될 위험이 있습니다.
|
||||
### 매 응용
|
||||
1. SaaS web app deploy.
|
||||
2. Library publish (npm, PyPI, Maven).
|
||||
3. Container image release.
|
||||
4. Mobile (Fastlane).
|
||||
5. ML model deploy (MLOps).
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- **Related Topics**: [[DevSecOps|데브섹옵스]], [[SAST|정적 분석]], [[DAST|동적 분석]], [[SCA|구성 분석]], 인프라 자동화(IaC)
|
||||
- **Projects/Contexts**: GitHub Actions, Jenkins, GitLab CI, ArgoCD 활용
|
||||
- **Contradictions/Notes**: CI/CD는 단순히 도구의 문제가 아니라 '문화'의 문제입니다. 실패 시 즉시 복구하고 문제를 공유하는 팀의 성숙도가 동반되어야 합니다 [1].
|
||||
## 💻 패턴
|
||||
|
||||
---
|
||||
*Last updated: 2026-05-08*
|
||||
### GitHub Actions reusable workflow
|
||||
```yaml
|
||||
# .github/workflows/ci.yml
|
||||
on: [pull_request, push]
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write # 매 OIDC
|
||||
jobs:
|
||||
test:
|
||||
uses: org/.github/.github/workflows/ts-ci.yml@v1
|
||||
with:
|
||||
node-version: '22'
|
||||
deploy:
|
||||
needs: test
|
||||
if: github.ref == 'refs/heads/main'
|
||||
uses: org/.github/.github/workflows/deploy.yml@v1
|
||||
with:
|
||||
env: prod
|
||||
```
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
### OIDC to AWS (no long-lived keys)
|
||||
```yaml
|
||||
- uses: aws-actions/configure-aws-credentials@v4
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::123:role/gha-deployer
|
||||
aws-region: us-east-1
|
||||
- run: aws s3 sync ./dist s3://my-bucket
|
||||
```
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
### Matrix test sharding
|
||||
```yaml
|
||||
strategy:
|
||||
matrix:
|
||||
shard: [1, 2, 3, 4]
|
||||
steps:
|
||||
- run: bun run vitest run --shard=${{ matrix.shard }}/4
|
||||
```
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
### Container build + sign + SBOM
|
||||
```yaml
|
||||
- uses: docker/build-push-action@v6
|
||||
id: build
|
||||
with: { tags: ghcr.io/org/app:${{ github.sha }}, push: true }
|
||||
- uses: anchore/sbom-action@v0
|
||||
with: { image: ghcr.io/org/app:${{ github.sha }}, format: spdx-json }
|
||||
- uses: sigstore/cosign-installer@v3
|
||||
- run: cosign sign --yes ghcr.io/org/app@${{ steps.build.outputs.digest }}
|
||||
```
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
### Argo Rollouts canary
|
||||
```yaml
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Rollout
|
||||
spec:
|
||||
strategy:
|
||||
canary:
|
||||
steps:
|
||||
- setWeight: 10
|
||||
- pause: { duration: 5m }
|
||||
- analysis: { templates: [{ templateName: error-rate }] }
|
||||
- setWeight: 50
|
||||
- pause: { duration: 10m }
|
||||
- setWeight: 100
|
||||
```
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
### Turborepo remote cache
|
||||
```bash
|
||||
# 매 first build seeds cache; later runs hit
|
||||
TURBO_TOKEN=$REMOTE_TOKEN TURBO_TEAM=acme bunx turbo run build --remote-cache-timeout=60
|
||||
```
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
## 매 결정 기준
|
||||
| 상황 | Tool |
|
||||
|---|---|
|
||||
| OSS / GitHub repo | GitHub Actions |
|
||||
| GitLab native | GitLab CI |
|
||||
| Monorepo many pipelines | Buildkite / Dagger |
|
||||
| K8s GitOps | Argo CD + Argo Rollouts |
|
||||
| Multi-cloud workflow | Dagger / Earthly |
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
**기본값**: 매 GitHub Actions + OIDC + reusable workflow + Argo Rollouts.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
## 🔗 Graph
|
||||
- 부모: [[Continuous Integration (지속적 통합, CI)]] · [[Continuous Delivery (지속적 제공, CD)]]
|
||||
- 변형: [[지속적 통합 (CI) 및 지속적 배포 (CD)]]
|
||||
- 응용: [[Engineering Metrics (DORA)]] · [[Feature-Flags]]
|
||||
- Adjacent: [[Husky]] · [[Test_Automation]] · [[Secret_Management]]
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
## 🤖 LLM 활용
|
||||
**언제**: workflow YAML drafting, failed-build log triage, retry-storm root-cause.
|
||||
**언제 X**: 매 deterministic step (lint/test) — pipeline 자체가 검증.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Long-lived AWS keys in secret**: 매 OIDC 사용.
|
||||
- **`if: always()` 남용**: 매 fail 무시 — 신뢰 무너짐.
|
||||
- **No cache**: 매 매 build 30분.
|
||||
- **Single-stage everything**: 매 fail-fast 설계 안 됨.
|
||||
- **No staging**: 매 직접 prod — rollback 어려움.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified: GitHub Actions docs; SLSA spec v1.0; Argo Rollouts docs; DORA report 2024.
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — pipeline stages + OIDC/SLSA/canary |
|
||||
|
||||
Reference in New Issue
Block a user