The DevOps Approach
DevOps combines development and operations to deliver software faster and more reliably. It breaks down silos between teams and emphasizes automation.
The DevOps Lifecycle
Plan → Create → Verify → Package → Release → Configure → Monitor
↑ |
└──────────────────────────────────────────────────────────┘
CI/CD Explained
| Term | Meaning | Automation Level |
|---|
| CI (Continuous Integration) | Build and test on every commit | Automated testing |
| CD (Continuous Delivery) | Ready to deploy at any time | Manual deploy trigger |
| CD (Continuous Deployment) | Auto-deploy to production | Fully automated |
CI Pipeline Example
Push Code → Build → Unit Tests → Integration Tests → Package
CD Pipeline Example
Package → Deploy to Staging → Acceptance Tests → Deploy to Production
What is GitLab?
GitLab is an integrated DevOps platform that provides:
- Source code management (like GitHub)
- CI/CD pipelines (built-in)
- Container registry
- Issue tracking
- Security scanning
- Deployment environments
GitLab vs GitHub
| Feature | GitLab | GitHub |
|---|
| CI/CD | Built-in (GitLab CI) | GitHub Actions |
| Registry | Integrated container registry | GitHub Packages |
| Self-hosted | Free (Community Edition) | Enterprise only |
| DevOps focus | Full lifecycle | Code-centric |
GitLab CI Components
| Component | Role |
|---|
.gitlab-ci.yml | Pipeline configuration file |
| Runner | Machine that executes jobs |
| Pipeline | Collection of jobs organized in stages |
| Stage | Group of jobs that run in parallel |
| Job | Individual task (build, test, deploy) |
| Artifact | Files produced by jobs |
How It Works
Developer pushes code
→ GitLab detects .gitlab-ci.yml
→ Pipeline is created
→ Runner picks up jobs
→ Jobs execute in stages
→ Results reported back
GitLab Runners
Runners are agents that execute CI/CD jobs. Types:
| Type | Scope | Use Case |
|---|
| Shared | All projects | GitLab.com default |
| Group | All projects in a group | Team-wide |
| Specific | Single project | Custom environments |
Executor Types
| Executor | Description |
|---|
| Shell | Runs commands directly on the runner machine |
| Docker | Runs jobs inside Docker containers |
| Kubernetes | Runs jobs as Kubernetes pods |
Creating a GitLab Project
- Sign up at gitlab.com
- Click New Project → Create blank project
- Name it, set visibility, check "Initialize with README"
- Click Create project
Summary
- DevOps combines development and operations for faster delivery
- CI automates building/testing; CD automates deployment
- GitLab provides an integrated platform for the entire lifecycle
.gitlab-ci.yml defines your pipeline configuration
- Runners execute the jobs defined in your pipeline
- Stages organize jobs; jobs within a stage run in parallel
Next Steps
Next, we'll write .gitlab-ci.yml files and configure complete CI/CD pipelines.