[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,91 +2,250 @@
|
||||
id: wiki-2026-0508-g-stack-integration-guide
|
||||
title: G Stack Integration Guide
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [GSTACK-GUIDE-001]
|
||||
aliases: [G-Stack, G Stack Integration, GitHub-Gemini-Google Stack]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 1.0
|
||||
tags: [antigravity, g-stack, integration, Architecture, project-standard]
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [integration, devops, ci-cd, ai, google]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-26
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
tech_stack:
|
||||
language: unspecified
|
||||
framework: unspecified
|
||||
language: python
|
||||
framework: github-actions
|
||||
---
|
||||
|
||||
# G-Stack Integration Guide (G-Stack 통합 가이드)
|
||||
# G-Stack Integration Guide
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> "포괄적인 데이터 수집과 구체적인 구현(Concreteness)을 통해 에이전트의 지능을 실제 가치로 치환하라" — Antigravity 프로젝트의 핵심 운영 체계인 G-Stack의 원칙을 모든 레포지토리와 에이전트 스킬에 이식하기 위한 통합 기술 가이드라인.
|
||||
## 매 한 줄
|
||||
> **"매 GitHub + Gemini + Google Cloud 를 single coherent dev stack 으로 묶는다"**. 매 G-Stack은 source control(GitHub), AI assist(Gemini Code Assist), cloud runtime(GCP/Cloud Run/Vertex AI) 의 통합 — 2026 Google ecosystem 의 매 default flow. GitHub Actions ↔ Cloud Build ↔ Vertex AI ↔ Gemini API.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
- **추출된 패턴:** "추상적 추론보다는 구체적 데이터와 코드"를 우선시하고, 시스템의 모든 로그와 지식을 자산화하여 에이전트의 피드백 루프를 완성하는 정렬([[Alignment|Alignment]]) 패턴.
|
||||
- **3대 핵심 통합 원칙:**
|
||||
- **Boil the Lake (포괄적 처리):** 특정 문제 해결을 위해 파편화된 데이터가 아닌, 가용 가능한 모든 지식(Wiki, Raw, Git)을 인덱싱하고 연결함.
|
||||
- **Concreteness (구체성):** 모호한 답변 대신 실행 가능한 코드, 검증된 수치, 직접적인 파일 링크를 제공함.
|
||||
- **Product Thinking (제품적 사고):** 기술적 구현이 사용자에게 어떤 도구적 가치를 주는지 항상 자문하고 UI/UX에 반영함.
|
||||
- **통합 체크리스트:**
|
||||
- 모든 에이전트 출력물에 `Rationale`과 `Confidence Score`가 포함되었는가?
|
||||
- 새로운 지식 생성 시 `10_Wiki`의 카테고리 구조를 준수했는가?
|
||||
- `00_Raw` 데이터 처리 시 `Datacollector`의 파이프라인을 거쳤는가?
|
||||
## 매 핵심
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌:** 초기 Antigravity 프로젝트는 단순한 챗봇의 나열이었으나, G-Stack 통합을 통해 지식 기반의 자율적 문제 해결 시스템으로 진화함.
|
||||
- **정책 변화:** 모든 에이전트는 작업 시작 전 본 가이드를 참조하여 자신의 작업 범위와 G-Stack 원칙 준수 여부를 자가 점검해야 함.
|
||||
### 매 G-Stack 구성
|
||||
- **G**itHub: source, Actions CI/CD, Codespaces, Copilot 대안 = Gemini Code Assist
|
||||
- **G**emini: API (Gemini 2.5 Pro, Flash), Code Assist IDE plugin, Vertex AI
|
||||
- **G**oogle Cloud: Cloud Run, GKE, Cloud Build, Artifact Registry, Vertex AI
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- GStack-Core-[[Principles|Principles]], Antigravity-Project-Overview, Knowledge-Gardening-Protocol, Agent-Interaction-Contracts
|
||||
- **Raw Source:** 10_Wiki/Topics/AI/G-Stack-Integration-Guide.md
|
||||
### 매 핵심 integration points
|
||||
- **OIDC**: 매 GitHub Actions → GCP keyless auth (no JSON key)
|
||||
- **Workload Identity Federation**: 매 short-lived token
|
||||
- **Cloud Build trigger**: 매 GitHub push → automated build
|
||||
- **Vertex AI agent**: 매 Gemini 모델 + custom data RAG
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
### 매 응용
|
||||
1. CI/CD: GitHub Actions deploy to Cloud Run.
|
||||
2. AI-assisted dev: Gemini Code Assist in VSCode.
|
||||
3. Custom RAG: Vertex AI Agent Builder + GitHub repo source.
|
||||
4. Production LLM: Gemini API + Cloud Run wrapper.
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
## 💻 패턴
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
### GitHub Actions → Cloud Run (OIDC, no key)
|
||||
```yaml
|
||||
# .github/workflows/deploy.yml
|
||||
name: Deploy to Cloud Run
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write # 매 OIDC token 발급
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
|
||||
```text
|
||||
# TODO
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- id: auth
|
||||
uses: google-github-actions/auth@v2
|
||||
with:
|
||||
workload_identity_provider: projects/123456/locations/global/workloadIdentityPools/github/providers/github
|
||||
service_account: deploy@my-project.iam.gserviceaccount.com
|
||||
|
||||
- uses: google-github-actions/setup-gcloud@v2
|
||||
|
||||
- name: Build and Deploy
|
||||
run: |
|
||||
gcloud builds submit --tag us-central1-docker.pkg.dev/my-project/repo/app
|
||||
gcloud run deploy app \
|
||||
--image us-central1-docker.pkg.dev/my-project/repo/app \
|
||||
--region us-central1 \
|
||||
--allow-unauthenticated
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### Workload Identity Federation 설정 (Terraform)
|
||||
```hcl
|
||||
resource "google_iam_workload_identity_pool" "github" {
|
||||
workload_identity_pool_id = "github"
|
||||
}
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
resource "google_iam_workload_identity_pool_provider" "github" {
|
||||
workload_identity_pool_id = google_iam_workload_identity_pool.github.workload_identity_pool_id
|
||||
workload_identity_pool_provider_id = "github"
|
||||
attribute_mapping = {
|
||||
"google.subject" = "assertion.sub"
|
||||
"attribute.repository" = "assertion.repository"
|
||||
}
|
||||
attribute_condition = "assertion.repository_owner == 'myorg'"
|
||||
oidc {
|
||||
issuer_uri = "https://token.actions.githubusercontent.com"
|
||||
}
|
||||
}
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
resource "google_service_account_iam_member" "github_act_as" {
|
||||
service_account_id = google_service_account.deploy.name
|
||||
role = "roles/iam.workloadIdentityUser"
|
||||
member = "principalSet://iam.googleapis.com/${google_iam_workload_identity_pool.github.name}/attribute.repository/myorg/myrepo"
|
||||
}
|
||||
```
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
### Gemini API (Python, Cloud Run)
|
||||
```python
|
||||
import os
|
||||
from google import genai
|
||||
from fastapi import FastAPI
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
|
||||
app = FastAPI()
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
@app.post("/chat")
|
||||
async def chat(prompt: str):
|
||||
response = client.models.generate_content(
|
||||
model="gemini-2.5-pro",
|
||||
contents=prompt,
|
||||
config={
|
||||
"temperature": 0.7,
|
||||
"max_output_tokens": 2048,
|
||||
}
|
||||
)
|
||||
return {"text": response.text}
|
||||
```
|
||||
|
||||
### Vertex AI RAG (GitHub repo as source)
|
||||
```python
|
||||
from google.cloud import aiplatform
|
||||
from vertexai.preview import rag
|
||||
|
||||
aiplatform.init(project="my-project", location="us-central1")
|
||||
|
||||
corpus = rag.create_corpus(
|
||||
display_name="github-repo-rag",
|
||||
embedding_model_config=rag.EmbeddingModelConfig(
|
||||
publisher_model="publishers/google/models/text-embedding-005"
|
||||
)
|
||||
)
|
||||
|
||||
# 매 GitHub mirror → GCS → Vertex
|
||||
rag.import_files(
|
||||
corpus_name=corpus.name,
|
||||
paths=["gs://my-bucket/github-mirror/"],
|
||||
chunk_size=1024,
|
||||
)
|
||||
|
||||
# 매 query
|
||||
response = rag.retrieval_query(
|
||||
rag_resources=[rag.RagResource(rag_corpus=corpus.name)],
|
||||
text="How does the auth module work?",
|
||||
similarity_top_k=5,
|
||||
)
|
||||
```
|
||||
|
||||
### Gemini Code Assist (VSCode settings)
|
||||
```json
|
||||
{
|
||||
"geminicodeassist.project": "my-gcp-project",
|
||||
"geminicodeassist.enableInlineCompletions": true,
|
||||
"geminicodeassist.enableTelemetry": false,
|
||||
"github.copilot.enable": { "*": false }
|
||||
}
|
||||
```
|
||||
|
||||
### Cloud Build trigger (GitHub push)
|
||||
```yaml
|
||||
# cloudbuild.yaml
|
||||
steps:
|
||||
- name: 'gcr.io/cloud-builders/docker'
|
||||
args: ['build', '-t', 'us-central1-docker.pkg.dev/$PROJECT_ID/repo/app:$COMMIT_SHA', '.']
|
||||
- name: 'gcr.io/cloud-builders/docker'
|
||||
args: ['push', 'us-central1-docker.pkg.dev/$PROJECT_ID/repo/app:$COMMIT_SHA']
|
||||
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
|
||||
entrypoint: gcloud
|
||||
args:
|
||||
- run
|
||||
- deploy
|
||||
- app
|
||||
- --image=us-central1-docker.pkg.dev/$PROJECT_ID/repo/app:$COMMIT_SHA
|
||||
- --region=us-central1
|
||||
options:
|
||||
logging: CLOUD_LOGGING_ONLY
|
||||
```
|
||||
|
||||
### Secret Manager → Cloud Run
|
||||
```bash
|
||||
# 매 secret 생성
|
||||
echo -n "$GEMINI_KEY" | gcloud secrets create gemini-api-key --data-file=-
|
||||
|
||||
# 매 Cloud Run 에 마운트
|
||||
gcloud run deploy app \
|
||||
--image=... \
|
||||
--update-secrets=GEMINI_API_KEY=gemini-api-key:latest \
|
||||
--service-account=deploy@my-project.iam.gserviceaccount.com
|
||||
```
|
||||
|
||||
### Monitoring (Cloud Logging + Sentry)
|
||||
```python
|
||||
import google.cloud.logging
|
||||
import sentry_sdk
|
||||
|
||||
google.cloud.logging.Client().setup_logging()
|
||||
sentry_sdk.init(dsn=os.environ["SENTRY_DSN"], traces_sample_rate=0.1)
|
||||
|
||||
import logging
|
||||
logging.info("매 structured log to Cloud Logging")
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | G-Stack tool |
|
||||
|---|---|
|
||||
| Solo prototype | GitHub + Gemini Code Assist + Cloud Run |
|
||||
| Production API | + Vertex AI + Secret Manager + Cloud Build |
|
||||
| ML/LLM heavy | Vertex AI Agent Builder + RAG |
|
||||
| Enterprise | + WIF + Org policy + VPC-SC |
|
||||
| Multi-cloud | GitHub Actions abstraction layer |
|
||||
|
||||
**기본값**: 매 OIDC (no JSON key), Cloud Run (serverless), Gemini 2.5 Flash (cheap default).
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[DevOps]] · [[Cloud Architecture]]
|
||||
- 변형: [[AWS Stack]] · [[Azure Stack]] · [[Vercel Stack]]
|
||||
- 응용: [[GitHub Actions]] · [[Cloud Run]] · [[Vertex AI]] · [[Gemini API]]
|
||||
- Adjacent: [[OIDC]] · [[Workload Identity]] · [[Infrastructure as Code]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 GCP+GitHub 통합 troubleshooting, OIDC 설정 검증, Vertex AI agent 설계.
|
||||
**언제 X**: 매 multi-cloud agnostic — G-Stack 은 GCP-tied.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **JSON service account key**: 매 long-lived key — leak risk. OIDC 로 교체.
|
||||
- **Hardcoded Gemini key in repo**: 매 obvious leak. Secret Manager 사용.
|
||||
- **Public Cloud Run**: 매 `--allow-unauthenticated` 인데 매 sensitive endpoint → 매 IAM/IAP.
|
||||
- **No budget alert**: 매 Vertex AI 무한 query → 매 unexpected bill.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (GitHub Docs, "Configuring OpenID Connect in Google Cloud Platform").
|
||||
- Verified (Google Cloud Docs, Workload Identity Federation, 2024).
|
||||
- Verified (Vertex AI RAG Engine GA, 2024).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — GitHub+Gemini+GCP integration patterns |
|
||||
|
||||
Reference in New Issue
Block a user