CI/CD Pipeline Setup
22 items · Technical · Hard difficulty · 2 hours
Step-by-step CI/CD pipeline setup for secure builds, tests, deploys, and rollbacks.
-
Initialize repository and define branch strategy
Create main/develop/feature branches and enforce branch protection rules.
-
Add CI/CD pipeline configuration file
Create pipeline YAML (e.g., .github/workflows/ci.yml) and validate syntax locally.
-
Store secrets in a secure secrets store
Use repo secrets or a vault; never commit credentials or plaintext keys.
- Add CI quality checks
-
Add lint job to pipeline
Run lint on PRs and fail fast to keep code consistent.
-
Add unit test job to pipeline
Run unit tests with coverage and parallelize where possible.
- Build and publish artifacts
-
Add build job and cache dependencies
Produce reproducible artifacts and enable caching for speed.
-
Build Docker image and tag appropriately
Tag images with commit SHA and semantic version where possible.
-
Push Docker image to registry using stored creds
Authenticate with least-privileged credentials and push immutable tags.
-
Scan Docker image for vulnerabilities
Use scanners like Trivy or Clair and fail builds on critical findings.
- Deploy and test in staging
-
Deploy to staging environment
Deploy using manifests, Helm, or Terraform; use a dedicated staging namespace.
-
Run automated staging smoke tests
Check critical endpoints, auth, and health endpoints in staging.
-
Add manual approval gate for production deploy
Require a human approval step or approval PR before production rollout.
-
Deploy to production after approval
Use rolling or canary deployments and respect maintenance windows.
-
Run production smoke tests and health checks
Run lightweight checks and verify metrics, logs, and traces.
-
Configure notifications for pipeline events
Send build failures and deploy results to Slack, email, or PagerDuty.
-
Implement automatic rollback procedure
Define triggers and steps to rollback to the previous stable release.
-
Document runbook and emergency contacts
Include commands, rollback steps, and on-call phone/emails.
-
Monitor metrics and set alerts for deploys
Track error rate, latency, and traffic; set alert thresholds.
-
Review and iterate on the pipeline configuration
Schedule periodic reviews to update tests, tooling, and permissions.
Printed from TickYouOff — the interactive version tracks your progress and can be shared with others.