CICD Interview 101
CI/CD Senior Engineer Interview Questions (Jenkins, Python, Maven, Jenkinsfile)
Section 1: Jenkins (Core & Advanced)
- What is Jenkins and how does it work? - Hint: Master-slave architecture 
- Answer: Jenkins is an open-source automation server used for CI/CD. It uses master-slave architecture to distribute build tasks across multiple machines. 
 
- Explain Jenkins pipeline. - Hint: Declarative vs Scripted 
- Answer: Jenkins Pipeline is a suite of plugins that supports implementing and integrating continuous delivery pipelines. It supports Declarative and Scripted syntaxes. 
 
- Difference between Declarative and Scripted Pipeline? - Hint: Syntax structure 
- Answer: Declarative pipeline uses a predefined structure, easier for beginners. Scripted pipeline is Groovy-based and offers more control and flexibility. 
 
- How do you handle parallel stages in Jenkins? - Hint: - parallelkeyword
- Answer: Use the - paralleldirective inside a stage to run tasks concurrently.
 
- What is the purpose of - agentin Jenkinsfile?- Hint: Execution context 
- Answer: Specifies where the pipeline or a specific stage should run (e.g., any, label, docker). 
 
- What is Jenkins shared library? - Hint: Reuse code across pipelines 
- Answer: It allows you to store common functions or pipeline code in a central repo and use them in multiple pipelines. 
 
- How do you trigger a Jenkins job remotely? - Hint: API token, curl 
- Answer: Use Jenkins REST API with a token, e.g., - curl -X POST <jenkins-url>/job/<job-name>/build?token=<token>.
 
- What are Jenkins credentials and how do you manage them? - Hint: Credentials plugin 
- Answer: Stored securely in Jenkins, managed via Credentials plugin. You can access them in pipelines using - credentials()or- withCredentials().
 
- Explain the use of - postblock in Declarative Pipeline.- Hint: Success/Failure/Always 
- Answer: Used for post-build actions like cleanup, notifications, only runs under defined conditions. 
 
- How to archive artifacts in Jenkins? - Hint: - archiveArtifactsstep
- Answer: Use - archiveArtifacts artifacts: 'target/*.jar'to retain build artifacts.
 
- What are Jenkins agents and how are they configured? - Hint: Nodes 
- Answer: Agents are worker nodes configured via UI or script. Can be static or auto-scaled with cloud providers. 
 
- What is the use of Blue Ocean in Jenkins? - Hint: UI improvement 
- Answer: Blue Ocean provides a modern and user-friendly UI for Jenkins pipelines. 
 
- How can you secure Jenkins? - Hint: Role-based access, security realm 
- Answer: Use matrix-based security, secure agents, plugins for roles, and enable security realms. 
 
- How do you integrate Jenkins with GitHub? - Hint: Webhook + Git plugin 
- Answer: Configure GitHub webhook to trigger builds, and use Git plugin in Jenkins. 
 
- What are some common Jenkins plugins you’ve used? - Hint: Git, Pipeline, Slack 
- Answer: Git plugin, Pipeline, Blue Ocean, Slack Notification, Credentials Binding, Maven Integration. 
 
- What is a Jenkinsfile? - Hint: Pipeline as Code 
- Answer: It is a text file that contains the definition of a Jenkins pipeline. 
 
- How do you pass parameters to a Jenkins pipeline? - Hint: - parametersblock
- Answer: Define using - parametersblock and access with- ${params.<param>}.
 
- How do you monitor Jenkins performance? - Hint: Metrics plugin 
- Answer: Use Monitoring plugin, Metrics, and external tools like Prometheus. 
 
- How do you handle failing steps without breaking the pipeline? - Hint: - catchError,- try-catch
- Answer: Use - catchErroror- try-catchin scripted pipelines.
 
- How do you perform rollback in Jenkins pipelines? - Hint: Tagging, artifact version 
- Answer: Use Git tags, versioned artifacts, or redeploy from a stable version. 
 
Section 2: Python (Build & Script Automation)
- How do you use Python in a Jenkins pipeline? 
- What is a virtualenv and how is it used? 
- How do you manage Python dependencies in a CI pipeline? 
- Write a Python script to validate a JSON configuration file. 
- How do you handle exceptions in a CI Python script? 
- How do you run unit tests in Python using Jenkins? 
- What is pytest and how is it integrated? 
- How do you generate test coverage reports in Python? 
- What are some best practices for writing CI-safe Python scripts? 
- How do you lint Python code in Jenkins? 
Section 3: Maven
- What is Maven and why is it used? 
- What is the structure of a - pom.xmlfile?
- Explain Maven lifecycle phases. 
- How do you create a Maven project? 
- How do you install dependencies using Maven? 
- What is the use of Maven profiles? 
- How do you publish Maven artifacts to Nexus/Artifactory? 
- How do you use Maven in a Jenkinsfile? 
- How do you skip tests in Maven builds? 
- What are common Maven plugins used in CI/CD? 
Section 4: Jenkinsfile
- What is the syntax of a Jenkinsfile? 
- How do you define environment variables? 
- How do you define a matrix build in a Jenkinsfile? 
- How do you load shared libraries? 
- How do you use - whenconditionals?
- How do you handle credentials securely in Jenkinsfile? 
- How do you run shell commands in Jenkinsfile? 
- How do you run parallel stages in a Jenkinsfile? 
- What is - inputstep in Jenkinsfile?
- How do you retry failed steps? 
Section 5: Advanced CI/CD Concepts
- Explain CI vs CD. 
- What are the advantages of CI/CD? 
- How do you implement Canary deployment? 
- What is Blue-Green deployment? 
- How do you version your applications in CI/CD? 
- What is Infrastructure as Code and how is it used in CI/CD? 
- How do you manage secrets in CI/CD? 
- What tools can you use for containerization in pipelines? 
- How do you test Docker images in CI/CD? 
- What is pipeline as code and its advantages? 
Section 6: Troubleshooting & Optimization
- How do you debug a failing Jenkins pipeline? 
- What are common issues in Jenkins builds? 
- How do you optimize pipeline execution time? 
- How do you ensure idempotency in pipelines? 
- What to do when Jenkins runs out of disk space? 
- How to prevent long-running builds from hanging Jenkins? 
- How do you limit concurrent builds? 
- How do you deal with flaky tests in CI? 
- How do you schedule jobs in Jenkins? 
- How do you clean up old jobs/artifacts? 
Section 7: Miscellaneous
- What are ephemeral agents and their benefit? 
- How do you implement approval gates in CI/CD? 
- What is the role of Slack/MS Teams integration? 
- How do you backup and restore Jenkins configuration? 
- What is Jenkins X? 
- Compare Jenkins with GitHub Actions. 
- How do you handle branching strategies in CI/CD? 
- What is multi-branch pipeline? 
- How do you set up cross-platform builds? 
- What is the role of Webhooks? 
Section 8: Real-World Scenarios
- CI pipeline for microservices with Python & Docker. 
- Handling a failing deployment in production. 
- Designing a zero-downtime deployment pipeline. 
- Integrating code quality checks (SonarQube). 
- Creating a rollback strategy. 
- Handling database migrations in CI/CD. 
- Monitoring deployments in real-time. 
- Setting up feature flag-driven deployment. 
- CI/CD pipeline for multi-language repo. 
- Automating security scans. 
Section 9: Behavioral & Strategy
- Describe a major CI/CD challenge you faced. 
- How do you keep up with CI/CD best practices? 
- What is your process for onboarding new developers to CI? 
- How do you handle downtime during pipeline maintenance? 
- How do you train teams on CI/CD? 
- How do you ensure pipeline quality and reliability? 
- What metrics do you track for CI/CD performance? 
- How do you plan CI/CD for greenfield projects? 
- Describe a time you automated a complex manual process. 
- How do you balance speed vs safety in deployments? 
 
 
No comments :
Post a Comment