|
| 1 | +import React from 'react'; |
| 2 | +import ThemeCard from '../../../../components/shared/ThemeCard'; |
| 3 | +import CICDPipelineViz from '../visualizations/2d/CICDPipelineViz'; |
| 4 | +import { GitBranch, CheckCircle, AlertTriangle, Lightbulb } from 'lucide-react'; |
| 5 | + |
| 6 | +const CICDPipeline: React.FC = () => { |
| 7 | + return ( |
| 8 | + <div className="max-w-5xl mx-auto space-y-8"> |
| 9 | + {/* Header */} |
| 10 | + <div className="bg-gradient-to-br from-sky-50 via-white to-cyan-50 rounded-2xl p-8 border border-sky-100 shadow-lg"> |
| 11 | + <div className="flex items-center gap-4 mb-4"> |
| 12 | + <div className="bg-sky-100 p-3 rounded-full"> |
| 13 | + <GitBranch className="w-8 h-8 text-sky-600" /> |
| 14 | + </div> |
| 15 | + <div> |
| 16 | + <h1 className="text-3xl font-bold text-gray-900">CI/CD Pipeline</h1> |
| 17 | + <p className="text-gray-600">Continuous Integration & Continuous Delivery</p> |
| 18 | + </div> |
| 19 | + </div> |
| 20 | + <p className="text-lg text-gray-700 leading-relaxed"> |
| 21 | + A CI/CD pipeline automates the journey from code commit to production deployment. Every |
| 22 | + code change is automatically built, tested, scanned for security vulnerabilities, and |
| 23 | + deployed — reducing human error and enabling teams to deploy hundreds of times per day. |
| 24 | + </p> |
| 25 | + </div> |
| 26 | + |
| 27 | + {/* Interactive Pipeline Visualization */} |
| 28 | + <ThemeCard> |
| 29 | + <h2 className="text-2xl font-bold text-gray-900 mb-4">Interactive Pipeline</h2> |
| 30 | + <p className="text-gray-700 mb-6 leading-relaxed"> |
| 31 | + Watch a complete CI/CD pipeline execute. Each stage runs automatically, and the pipeline |
| 32 | + halts if any stage fails — this is the "fail fast" principle. |
| 33 | + </p> |
| 34 | + <CICDPipelineViz /> |
| 35 | + </ThemeCard> |
| 36 | + |
| 37 | + {/* CI vs CD explanation */} |
| 38 | + <div className="grid md:grid-cols-2 gap-6"> |
| 39 | + <ThemeCard> |
| 40 | + <h3 className="text-xl font-bold text-gray-900 mb-4 flex items-center gap-2"> |
| 41 | + <CheckCircle className="w-5 h-5 text-sky-600" /> Continuous Integration (CI) |
| 42 | + </h3> |
| 43 | + <p className="text-gray-700 mb-4 leading-relaxed"> |
| 44 | + Developers merge their code changes into a shared repository multiple times a day. Each |
| 45 | + merge triggers an automated build and test suite. |
| 46 | + </p> |
| 47 | + <div className="bg-sky-50 rounded-lg p-4 border border-sky-200"> |
| 48 | + <h4 className="font-semibold text-sky-800 mb-2">CI Best Practices:</h4> |
| 49 | + <ul className="space-y-1.5 text-sm text-gray-700"> |
| 50 | + <li>• Commit to mainline at least once a day</li> |
| 51 | + <li>• Every commit triggers automated tests</li> |
| 52 | + <li>• Fix broken builds immediately (priority #1)</li> |
| 53 | + <li>• Keep the build fast (< 10 minutes)</li> |
| 54 | + </ul> |
| 55 | + </div> |
| 56 | + </ThemeCard> |
| 57 | + |
| 58 | + <ThemeCard> |
| 59 | + <h3 className="text-xl font-bold text-gray-900 mb-4 flex items-center gap-2"> |
| 60 | + <CheckCircle className="w-5 h-5 text-emerald-600" /> Continuous Delivery (CD) |
| 61 | + </h3> |
| 62 | + <p className="text-gray-700 mb-4 leading-relaxed"> |
| 63 | + Every change that passes the automated pipeline is <strong>ready to deploy</strong> to |
| 64 | + production. Continuous Deployment goes further — deploying automatically without human |
| 65 | + approval. |
| 66 | + </p> |
| 67 | + <div className="bg-emerald-50 rounded-lg p-4 border border-emerald-200"> |
| 68 | + <h4 className="font-semibold text-emerald-800 mb-2">Deployment Strategies:</h4> |
| 69 | + <ul className="space-y-1.5 text-sm text-gray-700"> |
| 70 | + <li> |
| 71 | + • <strong>Blue-Green:</strong> Two identical environments, swap traffic |
| 72 | + </li> |
| 73 | + <li> |
| 74 | + • <strong>Canary:</strong> Roll out to 5% of users first |
| 75 | + </li> |
| 76 | + <li> |
| 77 | + • <strong>Rolling:</strong> Gradually replace old instances |
| 78 | + </li> |
| 79 | + <li> |
| 80 | + • <strong>Feature Flags:</strong> Toggle features without deploy |
| 81 | + </li> |
| 82 | + </ul> |
| 83 | + </div> |
| 84 | + </ThemeCard> |
| 85 | + </div> |
| 86 | + |
| 87 | + {/* Popular CI/CD Tools */} |
| 88 | + <ThemeCard> |
| 89 | + <h2 className="text-2xl font-bold text-gray-900 mb-4">Popular CI/CD Tools</h2> |
| 90 | + <div className="grid grid-cols-2 md:grid-cols-4 gap-4"> |
| 91 | + {[ |
| 92 | + { name: 'GitHub Actions', icon: '🐙', desc: 'Native GitHub CI/CD' }, |
| 93 | + { name: 'Jenkins', icon: '🔧', desc: 'Open-source automation' }, |
| 94 | + { name: 'GitLab CI', icon: '🦊', desc: 'All-in-one DevOps' }, |
| 95 | + { name: 'CircleCI', icon: '⭕', desc: 'Cloud-native CI/CD' }, |
| 96 | + { name: 'ArgoCD', icon: '🚢', desc: 'GitOps for Kubernetes' }, |
| 97 | + { name: 'Spinnaker', icon: '🎡', desc: 'Multi-cloud deploy' }, |
| 98 | + { name: 'Travis CI', icon: '🏠', desc: 'Open-source CI' }, |
| 99 | + { name: 'AWS CodePipeline', icon: '☁️', desc: 'AWS native pipeline' }, |
| 100 | + ].map((tool, i) => ( |
| 101 | + <div |
| 102 | + key={i} |
| 103 | + className="bg-gray-50 rounded-xl p-4 text-center border border-gray-200 hover:shadow-md transition-shadow" |
| 104 | + > |
| 105 | + <span className="text-2xl">{tool.icon}</span> |
| 106 | + <h4 className="font-semibold text-gray-900 mt-2 text-sm">{tool.name}</h4> |
| 107 | + <p className="text-xs text-gray-600 mt-1">{tool.desc}</p> |
| 108 | + </div> |
| 109 | + ))} |
| 110 | + </div> |
| 111 | + </ThemeCard> |
| 112 | + |
| 113 | + {/* Anti-patterns */} |
| 114 | + <ThemeCard> |
| 115 | + <h2 className="text-2xl font-bold text-gray-900 mb-4 flex items-center gap-2"> |
| 116 | + <AlertTriangle className="w-6 h-6 text-amber-500" /> Common CI/CD Anti-Patterns |
| 117 | + </h2> |
| 118 | + <div className="grid md:grid-cols-2 gap-4"> |
| 119 | + {[ |
| 120 | + { |
| 121 | + bad: 'Long-lived feature branches (weeks/months)', |
| 122 | + fix: 'Merge to main daily, use feature flags', |
| 123 | + }, |
| 124 | + { |
| 125 | + bad: 'Skipping tests to "ship faster"', |
| 126 | + fix: 'Tests ARE the safety net — never skip', |
| 127 | + }, |
| 128 | + { bad: 'Manual deployment steps', fix: 'Automate everything, including rollbacks' }, |
| 129 | + { bad: 'No security scanning', fix: 'Add SAST/DAST/dependency scanning to pipeline' }, |
| 130 | + ].map((item, i) => ( |
| 131 | + <div key={i} className="bg-amber-50 rounded-lg p-4 border border-amber-200"> |
| 132 | + <div className="flex items-start gap-2 mb-2"> |
| 133 | + <span className="text-red-500 font-bold">✗</span> |
| 134 | + <span className="text-sm text-gray-700">{item.bad}</span> |
| 135 | + </div> |
| 136 | + <div className="flex items-start gap-2"> |
| 137 | + <span className="text-emerald-500 font-bold">✓</span> |
| 138 | + <span className="text-sm text-gray-700 font-medium">{item.fix}</span> |
| 139 | + </div> |
| 140 | + </div> |
| 141 | + ))} |
| 142 | + </div> |
| 143 | + </ThemeCard> |
| 144 | + |
| 145 | + {/* ELI10 */} |
| 146 | + <div className="bg-gradient-to-r from-amber-50 to-yellow-50 rounded-2xl p-6 border border-amber-200"> |
| 147 | + <div className="flex items-start gap-4"> |
| 148 | + <div className="bg-amber-100 p-2 rounded-full flex-shrink-0"> |
| 149 | + <Lightbulb className="w-6 h-6 text-amber-600" /> |
| 150 | + </div> |
| 151 | + <div> |
| 152 | + <h3 className="text-lg font-bold text-amber-900 mb-2"> |
| 153 | + Think of it like a factory assembly line 🏭 |
| 154 | + </h3> |
| 155 | + <p className="text-gray-700 leading-relaxed"> |
| 156 | + Imagine a toy factory. When you design a new toy, it goes through stations — each |
| 157 | + station checks something: "Is the paint right? Are the wheels on? Is it |
| 158 | + safe?" Only if the toy passes ALL stations does it go into a box and ship to |
| 159 | + stores. That's exactly what a CI/CD pipeline does for code — each stage verifies |
| 160 | + quality automatically! |
| 161 | + </p> |
| 162 | + </div> |
| 163 | + </div> |
| 164 | + </div> |
| 165 | + </div> |
| 166 | + ); |
| 167 | +}; |
| 168 | + |
| 169 | +export default CICDPipeline; |
0 commit comments