Scenario Based CI/CD Interview Questions and Answers
1. Build fails after merging code. What will you do?
Check build logs, identify failing stage, rollback if needed and fix code in feature branch.
2. Pipeline is too slow. How do you optimize it?
Enable parallel stages, cache dependencies and remove unnecessary steps.
3. Tests are flaky in pipeline.
Identify unstable tests, isolate them and improve test reliability.
4. Deployment failed but build succeeded.
Check deployment logs, server connectivity and rollback strategy.
5. Pipeline triggered by wrong branch.
Fix branch filters and trigger conditions.
6. Secrets exposed in pipeline logs.
Use secret managers, mask variables and remove echo statements.
7. Pipeline runs with old code.
Clean workspace and verify checkout configuration.
8. Manual deployment caused production issue.
Automate deployment and enforce pipeline-only releases.
9. Build artifact missing.
Check artifact path and archive step in pipeline.
10. Production deployment needs approval.
Add manual approval stage or environment gate.
11. CI pipeline fails due to dependency download.
Use caching and stable repositories.
12. Pipeline triggered too many times.
Fix webhook and disable duplicate triggers.
13. New release causes errors.
Rollback immediately and analyze metrics.
14. Pipeline does not notify failures.
Configure email or Slack notifications.
15. Build succeeds but tests are skipped.
Check test stage configuration and conditions.
16. Deployment works in staging but fails in production.
Check environment-specific configs and permissions.
17. Artifact version mismatch across environments.
Promote same artifact instead of rebuilding.
18. Pipeline is triggered accidentally.
Restrict permissions and require PR merges.
19. Database migration failed in pipeline.
Rollback migration and validate scripts in staging.
20. Rollback also failed.
Use backup restore and emergency fix.
21. CI server is down.
Switch to backup server and restore from backup.
22. Deployment happens without approval.
Add approval gate and environment checks.
23. Too many pipeline failures.
Improve test quality and stabilize infra.
24. Pipeline logs are too large.
Enable log rotation and reduce verbosity.
25. Pipeline uses hardcoded environment values.
Move values to config files or variables.
26. Production hotfix required.
Create hotfix branch, run pipeline and deploy safely.
27. Pipeline cannot access cloud resources.
Fix service account or IAM role permissions.
28. Build works locally but fails in CI.
Check tool versions and missing dependencies.
29. CI/CD pipeline is not scalable.
Use distributed agents and cloud runners.
30. How do you ensure CI/CD reliability?
Use automation, monitoring, rollback strategy and approvals.
Source: sureshtechlabs.com