Jenkins is an open-source automation server and one of the most widely used CI/CD tools. Even teams that also use GitHub Actions or GitLab CI often still run Jenkins for older or complex pipelines. These Jenkins interview questions and answers cover the core concepts, pipelines, security and day-to-day troubleshooting.

Basics
1. What is Jenkins?
Jenkins is a Java-based automation server. It builds, tests and deploys software automatically whenever code changes, and it extends through more than a thousand plugins.
2. Explain CI and CD.
- Continuous integration (CI): developers merge small changes often, and each change triggers an automated build and tests.
- Continuous delivery: every change that passes tests is ready to deploy with one approval.
- Continuous deployment: passing changes deploy to production automatically.
3. Describe the Jenkins architecture.
The controller (formerly called the master) schedules jobs, stores configuration and serves the web UI. Agents (formerly slaves) run the builds. Good practice is to run builds on agents, not on the controller, for both performance and security.
4. Freestyle job vs pipeline?
A freestyle job is configured through the web interface. A pipeline is defined as code in a Jenkinsfile, stored in the repository, so it is versioned, reviewed and reusable. Pipelines are now the standard.
Pipelines
5. Declarative vs scripted pipelines?
Declarative pipelines use a structured, simpler syntax. Scripted pipelines use Groovy code directly and offer more flexibility. Most teams start with declarative syntax.
6. Show a basic declarative pipeline.
pipeline {
agent any
stages {
stage('Build') {
steps { sh 'mvn -B clean package' }
}
stage('Test') {
steps { sh 'mvn test' }
}
stage('Deploy') {
when { branch 'main' }
steps { sh './deploy.sh' }
}
}
post {
always { junit 'target/surefire-reports/*.xml' }
}
}7. What is a multibranch pipeline?
It scans a repository and creates a pipeline for each branch or pull request that contains a Jenkinsfile. As a result, every branch is built and tested automatically.
8. How do you trigger builds?
Webhooks from GitHub, GitLab or Bitbucket are the best option. Alternatives include polling the repository, scheduled builds with cron syntax and upstream job triggers.
9. What are shared libraries?
Shared libraries store reusable pipeline code in a separate repository. Teams call common functions, such as security scans or deployment steps, from many Jenkinsfiles.
10. How do you run stages in parallel?
Use a parallel block inside a stage, for example to run unit tests and static analysis at the same time.
Credentials and security
11. How do you handle secrets?
Store them in the Jenkins Credentials store or an external secrets manager, and inject them with withCredentials. Never hard-code secrets in Jenkinsfiles or job settings.
12. How do you secure Jenkins?
- Keep Jenkins core and plugins updated; many vulnerabilities come from plugins.
- Enable authentication and role-based authorisation.
- Do not run builds on the controller.
- Put Jenkins behind HTTPS and restrict network access.
- Remove unused plugins and review script approvals.
- Back up
JENKINS_HOMEregularly.
13. What is Jenkins Configuration as Code (JCasC)?
A plugin that defines Jenkins settings in YAML. As a result, you can rebuild a controller consistently from version control.
Operations and troubleshooting
14. A build fails only on Jenkins. What do you check?
Compare environments: tool versions, environment variables, credentials, file permissions and agent labels. Then read the console output and reproduce the step on the agent.
15. How do you speed up slow pipelines?
Run stages in parallel, cache dependencies, use ephemeral container agents and avoid rebuilding unchanged components.
16. How do you install a plugin manually?
Normally, use the Plugin Manager. For offline installs, upload the .hpi file in the advanced plugin settings, then restart Jenkins.
17. Jenkins vs GitHub Actions?
Jenkins is self-hosted, highly customisable and plugin-driven. GitHub Actions is hosted, simpler to start and tightly integrated with GitHub. The choice depends on control, cost and where your code lives.
For more preparation, see our Git interview questions and DevOps interview questions.
Keep preparing
Practise each answer out loud, and run the commands in a lab rather than memorising them. Interviewers often ask follow-up questions, so make sure you understand why each answer is true.
Sources
Preparing for an interview? Browse more questions in our interview preparation hub. For businesses, we also offer security services such as VAPT, server hardening and ISO 27001 readiness.
