CI/CD Interview Questions (50+ Detailed Q&A)
1. Concepts & Pipelines
1. CI vs CD vs CD
1. CI vs CD vs CD
- CI (Integration): Merge code often -> Build -> Test. Detect bugs early.
- CD (Delivery): Code is ready to deploy. Artifact created. Manual approval to Prod.
- CD (Deployment): Zero touch. Pass test -> Auto Deploy to Prod.
2. Idempotency in DevOps
2. Idempotency in DevOps
mkdir flow fails 2nd time. mkdir -p is idempotent.
Ansible/Terraform are idempotent.3. Pipeline Stages
3. Pipeline Stages
4. Mutable vs Immutable Infrastructure
4. Mutable vs Immutable Infrastructure
- Mutable: SSH into server,
apt-get update. Drift happens. Hard to reproduce. - Immutable: Build new Image/VM. Replace old one. Consistent. Rollback easy.
5. Configuration Management vs Provisioning
5. Configuration Management vs Provisioning
- Provisioning: Create Infra (Terraform, CloudFormation).
- Config Mgmt: Configure OS/Software (Ansible, Chef, Puppet).
6. Monorepo vs Polyrepo CI
6. Monorepo vs Polyrepo CI
- Monorepo: Smart change detection needed (Did
/libchange? Build all dependents). Shared tooling. - Polyrepo: Simple. Repo change = Pipeline run. Dependency hell.
7. Artifact Management
7. Artifact Management
8. Self-hosted vs SaaS Runners
8. Self-hosted vs SaaS Runners
- SaaS (GitHub Actions): Easy. Pay/min. Security risk (Shared environment).
- Self-hosted: Control hardware, Network access (VPC), Cheaper at scale. Maintenance overhead.
9. Pipeline as Code
9. Pipeline as Code
Jenkinsfile, .gitlab-ci.yml) stored in Git.
Version controlled, Peer reviewed.10. Fan-out / Parallelism
10. Fan-out / Parallelism
2. Testing Strategies
11. The Testing Pyramid
11. The Testing Pyramid
- Base: Unit (70%). Fast, Cheap.
- Middle: Integration (20%).
- Top: E2E (10%). Slow, Flaky. If Inverted (Pizza/IceCream Cone): Anti-pattern. Slow feedback loop.
12. Unit vs Integration vs E2E
12. Unit vs Integration vs E2E
- Unit: Single function/class. Mock everything.
- Integration: Interaction (Service + DB).
- E2E: Full user journey (Selenium/Cypress). Real browser.
13. Smoke Testing / Sanity Testing
13. Smoke Testing / Sanity Testing
- Smoke: “Is it on fire?”. Basic check (Can I login?). Run after deployment.
- Sanity: Check specific new functionality.
14. Code Coverage
14. Code Coverage
15. Static Analysis (Linting)
15. Static Analysis (Linting)
16. Shift Left Testing
16. Shift Left Testing
17. Flaky Tests
17. Flaky Tests
18. Contract Testing (Pact)
18. Contract Testing (Pact)
19. Performance Testing
19. Performance Testing
- Load: Normal expected load.
- Stress: Breaking point.
- Soak: Long duration (Memory leaks).
- Spike: Sudden burst. Tool: JMeter, K6.
20. Test Data Management
20. Test Data Management
3. Deployment Patterns
21. Blue Green Deployment
21. Blue Green Deployment
22. Canary Deployment
22. Canary Deployment
23. Rolling Update
23. Rolling Update
24. Feature Toggles (Flags)
24. Feature Toggles (Flags)
if (flag).
Decouples Deployment (Binary move) from Release (Feature visibility).
A/B Testing.25. Shadow Deployment (Dark Launch)
25. Shadow Deployment (Dark Launch)
26. GitOps (ArgoCD)
26. GitOps (ArgoCD)
27. Recreate Strategy
27. Recreate Strategy
28. Rollback Strategy
28. Rollback Strategy
29. A/B Testing
29. A/B Testing
30. Environment Promotion
30. Environment Promotion
Dev -> QA -> Prod.
Configuration injected per env (Env vars).
Never rebuild for Prod (Risk different code).4. Security (DevSecOps)
31. SAST vs DAST
31. SAST vs DAST
- SAST: Static. Source Code scan. (Whitebox). Find SQLi pattern.
- DAST: Dynamic. Running App scan. (Blackbox). Attack running endpoint.
32. Dependency Scanning (SCA)
32. Dependency Scanning (SCA)
package.json against CVE database (Snyk, Dependabot).
Find vulnerable libraries.33. Container Scanning
33. Container Scanning
34. Secrets Management in CI
34. Secrets Management in CI
35. Least Privilege
35. Least Privilege
36. Signed Commits
36. Signed Commits
37. Supply Chain Attack
37. Supply Chain Attack
38. Image Signing
38. Image Signing
39. Compliance as Code
39. Compliance as Code
40. Hardening CI Environment
40. Hardening CI Environment
5. Tools & Troubleshooting
41. Docker in Docker (DinD)
41. Docker in Docker (DinD)
42. Jenkins vs GitHub Actions
42. Jenkins vs GitHub Actions
- Jenkins: Old, Powerful, Plugin hell, Self-hosted maintenance.
- GHA: YAML, Integrated, Marketplace, SaaS.
43. Build Caching
43. Build Caching
node_modules or maven repo.
Speeds up build. Use checksum of lockfile as cache key.44. Semantic Versioning
44. Semantic Versioning
45. Changelog Generation
45. Changelog Generation
feat: login, fix: bug).
Auto generate changelog based on types.46. Why did the pipeline fail?
46. Why did the pipeline fail?
- Read Logs.
- Reproduce locally.
- Check environment diff (Env vars).
- Flakiness?
47. Terraform State in CI
47. Terraform State in CI
48. Handling Database Migrations
48. Handling Database Migrations
49. ChatOps
49. ChatOps
/deploy prod).
Visibility for team.50. DORA Metrics
50. DORA Metrics
- Deployment Frequency.
- Lead Time for Changes (Code to Prod).
- Change Failure Rate.
- Time to Restore Service (MTTR).