[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-77187":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":21,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":16,"starSnapshotCount":16,"syncStatus":26,"lastSyncTime":27,"discoverSource":28},77187,"agentic-ai-demo","devopssessionsjvr\u002Fagentic-ai-demo","devopssessionsjvr","An AI-powered DevOps pipeline simulator combining CI\u002FCD, GitOps (ArgoCD), Kubernetes rollouts, and auto-fixing via AI-generated PRs.","https:\u002F\u002Fdevopssessionsjvr.github.io\u002Fagentic-ai-demo\u002F",null,"HTML",305,302,133,5,0,184,7.44,false,"demo",true,[],"2026-06-12 02:03:42","# 🚀 AI-Assisted CI\u002FCD with Kubernetes & Argo Rollouts\n\nComplete, production-ready CI\u002FCD workflow demonstrating **AI-assisted auto-fixing**, **GitOps with ArgoCD**, **canary deployments with Argo Rollouts**, and MTTR dashboard.\n\n---\n\n## 📋 Table of Contents\n\n- [Architecture Overview](#architecture-overview)\n- [Key Features](#key-features)\n- [Workflow Explanation](#workflow-explanation)\n- [Project Structure](#project-structure)\n- [Prerequisites](#prerequisites)\n- [Setup Instructions](#setup-instructions)\n- [Running the CI\u002FCD Pipeline](#running-the-cicd-pipeline)\n- [Monitoring & Dashboards](#monitoring--dashboards)\n- [Troubleshooting](#troubleshooting)\n- [Client Presentation Points](#client-presentation-points)\n\n---\n\n## 🏗️ Architecture Overview\n\n```\nDeveloper Push to 'demo' Branch\n        ↓\nGitHub Actions Triggers\n        ↓\n┌─────────────────────────────────────┐\n│  1. Security Scan (Trivy)           │\n│  2. Run Tests (Jest)                │\n└─────────────────────────────────────┘\n        ↓\n    Tests Failed?\n    \u002F           \\\n  YES            NO\n  ↓              ↓\n┌──────────────────┐  ┌─────────────────┐\n│ 3a. AI Auto-Fix  │  │ 3b. Skip Auto-  │\n│    (GPT-4)       │  │    fix, Continue│\n│ - Analyze Errors │  └─────────────────┘\n│ - Generate Fix   │        ↓\n│ - Create PR      │  ┌──────────────────────┐\n│ - Commit Changes │  │ 4. Build Docker      │\n└──────────────────┘  │    Image             │\n        ↓            │ - Multi-stage build  │\n    Tests Pass   │ - Scan for vulns     │\n        ↓            │ - Push to GHCR       │\n┌──────────────────────────────────────┐\n│ 5. Update Kubernetes Manifest        │\n│ - Update image tag in rollout.yaml   │\n│ - Update MTTR dashboard JSON         │\n│ - Commit changes to demo branch      │\n└──────────────────────────────────────┘\n        ↓\n┌──────────────────────────────────────┐\n│ 6. ArgoCD Detects Changes            │\n│ - Polls repository (or webhook)      │\n│ - Syncs manifests to Kubernetes      │\n│ - Creates\u002FUpdates Rollout resource   │\n└──────────────────────────────────────┘\n        ↓\n┌──────────────────────────────────────┐\n│ 7. Canary Rollout Progresses         │\n│ Step 1: 10% traffic (5 min) ↓         │\n│ Step 2: 25% traffic (5 min) ↓         │\n│ Step 3: 50% traffic (5 min) ↓         │\n│ Step 4: 75% traffic (5 min) ↓         │\n│ Step 5: 100% traffic (Complete)     │\n│                                      │\n│ Automatic rollback if metrics fail  │\n└──────────────────────────────────────┘\n        ↓\n┌──────────────────────────────────────┐\n│ 8. MTTR Dashboard Updates            │\n│ - Record deployment metrics          │\n│ - Track canary progression           │\n│ - Calculate MTTR (Mean Time to       │\n│   Recovery)                          │\n└──────────────────────────────────────┘\n```\n\n---\n\n## ✨ Key Features\n\n### 1. **AI-Assisted Auto Fix** 🤖\n- Automatically detects test failures\n- Calls OpenAI GPT-4 API to analyze issues\n- Generates code fixes\n- Creates pull request with fixes\n- Allows team review before merge\n\n**Example Flow:**\n```\nTest Fails → AI Analyzes → PR Created → Team Reviews → Merge → Deploy\n```\n\n### 2. **GitOps with ArgoCD** 🔄\n- Single source of truth: Git repository\n- ArgoCD continuously syncs manifests\n- Changes to Git automatically deploy\n- Built-in rollback capabilities\n- Declarative infrastructure\n\n### 3. **Canary Deployments** 📊\n- Gradual traffic shifting (10% → 25% → 50% → 75% → 100%)\n- Automatic validation at each step\n- Metrics-based rollback on failure\n- Zero-downtime deployments\n- Risk mitigation for critical apps\n\n### 4. **MTTR Dashboard** 📈\n- Tracks deployment metrics\n- Calculates Mean Time To Recovery\n- Shows AI fix effectiveness\n- Visual representation of canary progress\n- Historical data for trend analysis\n\n### 5. **Security & Best Practices** 🔒\n- Multi-stage Docker builds (optimized images)\n- Non-root container execution\n- Security scanning with Trivy\n- RBAC controls\n- Resource limits and requests\n- Health probes (liveness, readiness, startup)\n\n---\n\n## 🔄 Workflow Explanation\n\n### Step-by-Step Execution\n\n#### **Phase 1: Initial Setup**\nDeveloper pushes code to `demo` branch → GitHub Actions workflow triggers automatically.\n\n#### **Phase 2: Tests & Security**\n1. **Security Scan** - Trivy scans Docker image for vulnerabilities\n2. **Unit Tests** - Jest runs all tests in `\u002Fapp\u002Ftests\u002F`\n   - Tests check: `\u002Fstatus` endpoint, health checks, error handling\n   - Coverage enforced at 70% minimum\n\n#### **Phase 3: If Tests Fail**\n1. **AI Analysis** - GitHub Actions calls OpenAI API\n   - Analyzes test failure stack traces\n   - Generates root cause analysis\n   - Proposes code fixes\n\n2. **Auto-Fix Branch** - Creates new branch: `ai-fix\u002Ftest-failure-{timestamp}`\n   - Applies AI-generated fixes\n   - Adds documentation of changes\n   - Commits to new branch\n\n3. **Pull Request** - Creates PR with:\n   - Detailed AI analysis\n   - Fix explanation\n   - Link to workflow run\n   - Request for review\n\n4. **Manual Review** - Team reviews and approves\u002Frejects\n\n#### **Phase 4: Build & Push**\n- Builds Docker image with multi-stage approach\n- Scans Docker image for vulnerabilities\n- Pushes to GitHub Container Registry (GHCR)\n- Tags with: `branch-{commit_sha_short}` (e.g., `demo-abc123de`)\n\n#### **Phase 5: Update Manifests**\n- Updates `manifests\u002Fai-showcase\u002Frollout.yaml` with new image tag\n- Updates `dashboard\u002Fmttr.json` with deployment record\n- Commits changes back to `demo` branch\n\n#### **Phase 6: ArgoCD Synchronization**\n1. **Change Detection** - ArgoCD polls repository (default: every 3 minutes)\n   - Alternatively: Webhook triggers instant sync\n   \n2. **Manifest Sync** - ArgoCD applies manifests to Kubernetes cluster\n   - Creates\u002FUpdates resources in `ai-showcase` namespace\n   - Matches desired state (Git) with live state (cluster)\n\n3. **Rollout Initiation** - Argo Rollouts resource created\u002Fupdated\n   - New ReplicaSet created with updated image\n   - Old ReplicaSet kept for rollback\n   - Traffic routing configured\n\n#### **Phase 7: Canary Rollout Progression**\n\n**Step 1: 10% Canary (5 minutes)**\n- 1 out of 10 pods runs new version\n- 10% of traffic routed to canary\n- Prometheus metrics collected\n- Error rate checked: must be ≤ 1%\n- Response time checked: p95 must be ≤ 500ms\n\n```\nActive Pods:  [NEW, OLD, OLD, OLD, OLD, OLD, OLD, OLD, OLD, OLD]\nTraffic:      10% → NEW,  90% → OLD\n```\n\n**Step 2: 25% Canary (5 minutes)**\n- 2-3 out of 10 pods run new version\n- 25% of traffic routed to canary\n- Validation repeated\n\n**Step 3: 50% Blue-Green (5 minutes)**\n- Half the cluster on new version\n- 50% traffic split\n- Higher confidence in new version\n\n**Step 4: 75% Canary (5 minutes)**\n- 7-8 out of 10 pods run new version\n- 75% traffic routed to canary\n- Final validation\n\n**Step 5: 100% Rollout (Complete)**\n- All pods running new version\n- 100% traffic to new version\n- Old ReplicaSet retained for quick rollback\n\n**Automatic Rollback Example:**\n- If error rate > 1% at any step → automatically rollback\n- If response time p95 > 500ms → automatically rollback\n- Manual rollback available anytime\n\n#### **Phase 8: MTTR Dashboard Update**\n- Records deployment start\u002Fend times\n- Calculates MTTR (minutes)\n- Stores: commit hash, author, test status, AI fix status, canary progress\n- Updates aggregate statistics\n\n---\n\n## 📁 Project Structure\n\n```\nagentic-ai-demo\u002F\n├── app\u002F                                    # Node.js Express Application\n│   ├── app.js                              # Main Express server\n│   ├── package.json                        # Dependencies\n│   ├── jest.config.js                      # Jest test configuration\n│   ├── Dockerfile                          # Multi-stage production build\n│   ├── .dockerignore                       # Docker build exclusions\n│   ├── .env.example                        # Environment variables template\n│   └── tests\u002F\n│       └── app.test.js                     # Unit tests (Jest)\n│\n├── manifests\u002F\n│   └── ai-showcase\u002F                        # Kubernetes manifests (GitOps)\n│       ├── namespace.yaml                  # ai-showcase namespace\n│       ├── configmap.yaml                  # App config & MTTR schema\n│       ├── secret.yaml                     # API keys (reference only)\n│       ├── deployment.yaml                 # Standard Kubernetes Deployment\n│       ├── service.yaml                    # LoadBalancer Service\n│       ├── rollout.yaml                    # Argo Rollout (canary config)\n│       ├── rbac.yaml                       # ServiceAccount, Role, RoleBinding\n│       └── argocd-app.yaml                 # ArgoCD Application & Project\n│\n├── dashboard\u002F\n│   └── mttr.json                           # MTTR Dashboard data\n│\n├── .github\u002F\n│   └── workflows\u002F\n│       └── ci-cd.yml                       # GitHub Actions Workflow\n│           │\n│           ├─ Job 1: Security Scan (Trivy)\n│           ├─ Job 2: Run Tests (Jest)\n│           ├─ Job 3: AI Auto-Fix (on test failure)\n│           ├─ Job 4: Build Docker Image\n│           ├─ Job 5: Update Kubernetes Manifest\n│           ├─ Job 6: Watch ArgoCD Sync\n│           └─ Job 7: Finalize Deployment\n│\n└── README.md                               # This file\n```\n\n---\n\n## 📦 Prerequisites\n\n### Local Development\n- **Node.js** 18.x or later\n- **npm** 8.x or later\n- **Docker** (for building images)\n- **kubectl** (for Kubernetes operations)\n\n### Infrastructure\n- **Kubernetes Cluster** (1.24+)\n  - Options: EKS, GKE, AKS, or local (Minikube\u002FKind)\n- **Argo Rollouts** installed in cluster\n  ```bash\n  kubectl apply -n argo-rollouts -f \\\n    https:\u002F\u002Fgithub.com\u002Fargoproj\u002Fargo-rollouts\u002Freleases\u002Fdownload\u002Fstable\u002Finstall.yaml\n  ```\n- **ArgoCD** installed in cluster\n  ```bash\n  kubectl create namespace argocd\n  kubectl apply -n argocd -f https:\u002F\u002Fraw.githubusercontent.com\u002Fargoproj\u002Fargo-cd\u002Fstable\u002Fmanifests\u002Finstall.yaml\n  ```\n- **Prometheus** (optional, for metrics-based canary validation)\n\n### GitHub Configuration\n- Repository with GitHub Actions enabled\n- **Secrets configured** in repository settings:\n  - `OPENAI_API_KEY` - For AI-assisted fixes\n  - `GITHUB_TOKEN` - For creating PRs (default provided)\n  - `DOCKER_REGISTRY_TOKEN` - For GHCR push (if not using GitHub token)\n\n### Container Registry\n- **GitHub Container Registry (GHCR)** OR Docker Hub\n- Credentials configured in GitHub Actions\n\n---\n\n## 🚀 Setup Instructions\n\n### 1. Clone Repository\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fyour-org\u002Fyour-repo.git\ncd agentic-ai-demo\n```\n\n### 2. Check Out Demo Branch\n```bash\ngit checkout demo\n# Or create if doesn't exist:\ngit checkout -b demo\n```\n\n### 3. Install Local Dependencies\n```bash\ncd app\nnpm install\nnpm install --save-dev  # dev dependencies for testing\n\n# Verify installation\nnpm test\n```\n\n### 4. Configure Environment Variables\n```bash\ncp app\u002F.env.example app\u002F.env\n\n# Edit .env with your values\nnano app\u002F.env\n```\n\n### 5. Build Docker Image Locally (Optional)\n```bash\ncd app\ndocker build -t ghcr.io\u002Fyour-org\u002Fai-showcase-app:local .\ndocker run -p 3000:3000 ghcr.io\u002Fyour-org\u002Fai-showcase-app:local\n# Test: curl http:\u002F\u002Flocalhost:3000\u002Fstatus\n```\n\n### 6. Configure GitHub Secrets\n```bash\n# Go to: Settings → Secrets and variables → Actions\n# Add:\n#   - OPENAI_API_KEY=sk-...\n#   - (GITHUB_TOKEN is provided by default)\n```\n\n### 7. Update Manifest Variables\nReplace these in all manifests:\n- `your-org` → Your GitHub organization\n- `your-repo` → Your repository name\n- `your-domain.com` → Your domain\n\n```bash\n# Batch replace (macOS):\nfind manifests -name \"*.yaml\" -exec sed -i '' 's|your-org|myorg|g' {} \\;\nfind manifests -name \"*.yaml\" -exec sed -i '' 's|your-repo|myrepo|g' {} \\;\n```\n\n### 8. Setup Kubernetes Namespace & Secrets\n```bash\n# Create namespace\nkubectl create namespace ai-showcase\n\n# Create registry secret for GHCR\nkubectl create secret docker-registry ghcr-secret \\\n  --docker-server=ghcr.io \\\n  --docker-username=\u003Cgithub-username> \\\n  --docker-password=\u003Cgithub-token> \\\n  --docker-email=\u003Cemail> \\\n  -n ai-showcase\n\n# Create app secrets\nkubectl apply -f manifests\u002Fai-showcase\u002Fsecret.yaml\n```\n\n### 9. Deploy ArgoCD Application\n```bash\n# Create ArgoCD app\nkubectl apply -f manifests\u002Fai-showcase\u002Fargocd-app.yaml\n\n# Verify\nkubectl get application -n argocd\n```\n\n---\n\n## 🔥 Running the CI\u002FCD Pipeline\n\n### Trigger Option 1: Push to Demo Branch\n```bash\ngit add .\ngit commit -m \"feat: Add new feature\"\ngit push origin demo\n\n# GitHub Actions automatically triggers\n# Check progress: GitHub → Actions tab\n```\n\n### Trigger Option 2: Manual Workflow Dispatch\n```bash\n# In GitHub UI:\n# Actions → CI-CD Workflow → Run workflow → Select 'demo' branch\n```\n\n### Monitor Workflow Execution\n\n**In GitHub:**\n1. Go to `Settings → Actions`\n2. Click on latest workflow run\n3. View real-time logs:\n   - Security Scan\n   - Test Results\n   - Docker Build\n   - Manifest Updates\n\n**In Kubernetes:**\n```bash\n# Watch manifest updates\nkubectl get rollout -n ai-showcase -w\n\n# View pod status\nkubectl get pods -n ai-showcase -w\n\n# Check canary progress\nkubectl get rollout ai-showcase-app -n ai-showcase -o yaml | grep -A 10 'status'\n\n# View events\nkubectl get events -n ai-showcase --sort-by='.lastTimestamp'\n```\n\n**In ArgoCD UI:**\n```bash\n# Port-forward to ArgoCD\nkubectl port-forward -n argocd svc\u002Fargocd-server 8080:443\n\n# Open: https:\u002F\u002Flocalhost:8080\n# Username: admin\n# Password: $(kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath=\"{.data.password}\" | base64 -d)\n\n# Watch application sync\n```\n\n---\n\n## 📈 Monitoring & Dashboards\n\n### MTTR Dashboard (JSON View)\nAccess `dashboard\u002Fmttr.json` to see deployment metrics\n## 📊 Live MTTR Dashboard\n👉 https:\u002F\u002Fdevopssessionsjvr.github.io\u002Fagentic-ai-demo\u002F\n\n### Kubernetes Dashboards\n```bash\n# Helm chart for monitoring setup (optional):\nhelm repo add prometheus-community https:\u002F\u002Fprometheus-community.github.io\u002Fhelm-charts\nhelm install prometheus prometheus-community\u002Fkube-prometheus-stack -n monitoring\n\n# View metrics\nkubectl port-forward -n monitoring svc\u002Fprometheus-operated 9090:9090\n# Open: http:\u002F\u002Flocalhost:9090\n```\n\n---\n\n## 🔧 Troubleshooting\n\n### Issue: Tests Fail, AI Fix Not Created\n\n**Cause:** OpenAI API key not configured\n\n**Solution:**\n```bash\n# Verify secret exists\nkubectl get secret -n ai-showcase ai-showcase-secrets\n\n# Check GitHub secret\n# Settings → Secrets → OPENAI_API_KEY\n```\n\n### Issue: ArgoCD Not Syncing\n\n**Cause:** ArgoCD application not found or repo not accessible\n\n**Solution:**\n```bash\n# Check ArgoCD app\nkubectl get application -n argocd\n\n# Check ArgoCD logs\nkubectl logs -n argocd deployment\u002Fargocd-application-controller\n\n# Manually sync\nargocd app sync ai-showcase --grpc-web\n```\n\n### Issue: Canary Rollout Stuck at 10%\n\n**Cause:** Metrics validation failing\n\n**Solution:**\n```bash\n# Check Argo Rollout status\nkubectl describe rollout ai-showcase-app -n ai-showcase\n\n# View analysis results\nkubectl get analysis -n ai-showcase\n```\n\n---\n\n## 👥 Support\n\nFor questions or issues:\n1. Check [Troubleshooting](#troubleshooting) section\n2. Review logs: `kubectl logs -n ai-showcase -l app=ai-showcase`\n3. Check GitHub Actions workflow runs\n4. Open GitHub issue with logs\n\n---\n\n**Built with ❤️ for DevOps Excellence**\n**Version:** 1.0.0 | **Status:** Production Ready ✅\n\n","该项目是一个结合了CI\u002FCD、GitOps（ArgoCD）、Kubernetes滚动更新以及通过AI生成的PR自动修复的DevOps流水线模拟器。其核心功能包括利用GPT-4分析并自动生成代码修复建议，实现测试失败时的自动化修复；支持基于ArgoCD的GitOps实践和基于Argo Rollouts的金丝雀部署策略；还提供了MTTR（平均恢复时间）监控仪表盘以追踪部署指标。适用于希望提高软件交付效率与质量、探索智能运维可能性的企业或团队，在持续集成与持续部署过程中遇到常见问题时能够快速响应并减少人为干预。",2,"2026-06-11 03:55:08","CREATED_QUERY"]