Top 50 Jenkins Interview Questions For 2021
Looking for Jenkins interview questions? Here is a list of 50 high-quality questions that will help you crack your next Jenkins interview.
During an interview, the interviewer will probably start by asking basic questions like "what is Jenkins, "what are its features", "what are its advantages", and so on. Nevertheless, he will probably increase the level of difficulty of the questions once he knows how much knowledge you have. Make your answers as concise as possible.
Whether you are new to Jenkins or an experienced programmer with some hands-on, our comprehensive list of questions will help you crack any Jenkins interview. Starting from the basic level, the difficulty level of questions will gradually increase as we approach the last question.
Jenkins is the most popular tool to do Continuous Integration and Continuous Delivery of your software. Thus, learning Jenkins from the best Jenkins tutorials will benefit you greatly.
Jenkins Interview Questions For Beginners and Experienced
1. What is Jenkins?
Answer: Jenkins is a free software tool with a continuous integration plugin for development. It is primarily responsible for keeping track of the revision control system and initiating and monitoring build systems when changes take place. During the whole process, the system provides reports and warnings.
2. What is continuous integration?
Answer: All development work is integrated as soon as possible through continuous integration. Tests are automatically run on the resulting artifacts. In this way, errors are found early on in the project.
3. List some features of Jenkins.
Answer: Jenkins has the following features:
- Open-source and Free
- Comprehensive set of plugins and integrations
- Exceptional community and documentation
- Java-based, thus easy to set up, install, and use on any platform.
- Ensures distributed builds with master-slave architecture, reducing CI server load.
4. What are the requirements for using Jenkins?
Answer: Jenkins requires the following:
- An accessible source code repository, like a Git repository.
- A working build script in the repository, like a Maven script.
5. What are the advantages of Jenkins?
Answer: Jenkins has several advantages, including:
- You can cache build failures at the integration stage.
- An automatic build report is generated for every code commit change.
- It integrates with the LDAP mail server to deliver notifications when the build report is successful or unsuccessful.
- It achieves continuous integration, test-driven development, and agile development.
- Using simple steps, you can automate maven release projects.
- It's easier to track bugs in a development environment than in production.
6. Mention some of the useful plugins in Jenkin?
Answer: Jenkin has several important plugins, including
- Amazon EC2
- Copy artifact
- Maven 2 project
- Green Balls
- HTML publisher
7. Explain how you can move or copy Jenkins from one server to another?
Answer: To move or copy Jenkins from one server to another, follow these simple steps:
- Move a job from one installation of Jenkins to another by copying the relevant job directory.
- Clone an existing job directory by choosing a different name from the original.
- By renaming a directory, you can rename an existing job.
8. What commands can be used to start Jenkins manually?
Answer: Jenkins can be started manually using either of the following methods:
- (Jenkins_url)/restart: Force Restarts Jenkins without waiting for the current build to complete.
- (Jenkin_url)/safeRestart: It lets all running builds finish.
9. How can you deploy a custom build of a core plugin?
Answer: The following steps will help you deploy a custom field in a core plugin:
- Stop Jenkins
- Copy the custom HPI into $Jenkins_Home/plugins
- Delete the previously expanded plugins directory
- Create an empty file named .hpi.pinned
10. What are the two components Jenkins is primarily integrated with?
Answer: Jenkin is mainly composed of two components:
- Version Control systems like SVN, GIT
- Build tools like Apache Maven.
11. Explain how you can create a backup and copy files in Jenkins?
Answer: Jenkins saves all setup information, build logs, and build artifacts in its home directory, so if you would like to have a backup of your Jenkins installation, copy this directory. To clone or replicate a job, you can copy the job directory or rename it.
12. Explain how you can clone a Git repository via Jenkins?
Answer: Jenkins requires your Jenkins system's user name and email address to clone a Git repository. To do that, you must switch to your job directory and execute the "git config" command.
13. How did Jenkins come into existence?
Answer: Jenkins was originally called Hudson before Oracle acquired ownership to continue development by renaming it, Jenkins.
14. Explain how you can set up a Jenkins job?
Answer: Well, to create a project that is handled with jobs in Jenkins. Select New from the menu, then name the job and choose Freestyle from the dropdown menu. After creating the job in Jenkins, click OK. During the next step, you can set up your job.
15. Define the process of Jenkins.
- To begin, a developer commits the code into a source code repository. During this time, Jenkins checks the repository for updates regularly.
- Immediately after a commit occurs, the Jenkins server detects the changes made to the source code repository. Jenkins will pull the changes and prepare a new build.
- Upon failure, the concerned team is notified.
- Jenkins deploys the build to the test server if the build is successful.
- Jenkins then generates feedback and notifies the developers of the build and test results.
- It will check the source code repository for any changes made to the source code and repeat this process for as long as needed.
16. How do you install Jenkins?
Answer: Follow these five steps to install Jenkins:
- Install Java Version 8: Jenkins is a Java-based application, so Java is required.
- Install Apache Tomcat Version 9: Tomcat is required to deploy Jenkins war files.
- Download Jenkins war File: This is a prerequisite for installing Jenkins.
- Deploy Jenkins war File: To run Jenkins, you deploy Jenkins war files using Tomcat.
- Install Suggested Plugins: Install all plugins recommended by Jenkins.
You can view the Jenkins dashboard once the installation has finished.
17. How is continuous integration achieved using Jenkins?
Answer: Here are the steps to achieve continuous integration using Jenkins:
- Source code changes from all the developers are committed to the shared Git repository.
- Jenkins server checks the shared Git repository at specified intervals, and changes detected are incorporated into builds.
- Test results and build results are shared with developers
- Test servers, such as Selenium, are used to display the built application and run automated tests on it.
- Builds that have been cleaned up and tested are deployed to production servers.
18. What other continuous integration tools do you know? What makes Jenkins better than any of those?
Answer: There are numerous CI tools, with the most prominent ones being –
- Travis CI
- Circle CI
TeamCity, for example, has excellent .NET support, but it's complex and expensive, whereas Travis CI is free just like Jenkins and has good documentation, too. Bamboo is fast and efficient, but it's not entirely free, so it's not the best solution.
19. What are the system requirements to install Jenkins?
Answer: The minimum system requirements to install Jenkins are-
- 256MB of RAM
- 1GB drive space
- Web browser
20. What is Groovy?
Answer: Groovy is a Java language from Apache. Jenkins uses it for its native scripting. Groovy-based plugins make Jenkins more dynamic and provide build reports consistently and dynamically.
21. What is DevOps and in which stage does Jenkins fit in?
Answer: As a software development methodology, DevOps combines software development (Dev) and IT operations (Ops) to make the entire development lifecycle simpler and shorter by delivering regular builds, fixes, and updates. Jenkins plays a crucial role in this integration because it helps in integration by automating the build, test, and deployment processes.
22. Can you start Jenkins using the command line? How?
Answer: Using the command line to start Jenkins is possible by using
23. What are the SCM tools that Jenkins supports?
Answer: Jenkins supports the following SCM tools: SVN, Clearcase, CVS, Git, AccuRev, Perforce, RTC, Mercurial.
24. What is meant by the Jenkins pipeline?
Answer: Pipelines are groups of interlinked jobs performed one after another in sequential order. Jenkins pipelines provide several plugins that allow you to integrate and implement continuous delivery pipelines. Code consists of instructions on how to act.
25. What are the types of pipelines in Jenkins?
Answer: There are 3 types of pipelines:
- CI CD pipeline (Continuous Integration Continuous Delivery)
- Scripted pipeline
- Declarative pipeline
26. What is a job in Jenkins?
Answer: In the entire process of building, a job is a step or a task. You could compile the source code, run unit tests, deploy the application to a web server, etc.
27. How can you create a job?
Answer: Select 'New Job' from the dashboard page. When you create a job, you can select options like the SCM, control triggers, build script, and notification settings.
28. What syntax does Jenkins use to schedule build job or SVN polling?
Answer: Cron Syntax.
The cron syntax is represented by five asterisks separated by spaces. Here is the syntax: [minutes] [hours] [day of the month] [month] [day of the week]. For Example: If you want a cron to run every Monday at 11.59 pm, it would be
59 11 * * 1
29. How can you use a third-party tool in Jenkins?
Answer: Let's say we want to use Node, a third-party tool.
- Install Node first.
- After that, install the Jenkins plugin for a node through the Jenkins admin console.
- In the admin console, click Manage and then click Tools.
- You can add any configured NodeJS tool to your build job in a pipeline.
Depending on the configuration settings, the procedure may vary slightly for different third-party tools.
30. Explain the Difference between Jenkins and Bamboo?
|A global community of supporters.
|It has a dedicated development team.
|It is less user-friendly than Bamboo.
|Has many plugins for performing various functions.
|It comes with many features and you can also get plugins from the Atlassian marketplace.
31. How does Jenkins authenticate users?
Answer: There are three ways by which Jenkins authenticates users:
- By default, user data and credentials are stored in an internal database.
- Set up Jenkins to use the authentication mechanism provided by the application server on which it is deployed.
- Set up Jenkins to authenticate against the LDAP server.
32. Why is Jenkins used with Selenium?
Answer: Jenkins can run Selenium tests whenever there are changes to the software or the environment. Integration of the Selenium test suite with Jenkins allows testing to run automatically as part of the build process.
33. What is Kubernetes? How can you integrate Jenkins with Kubernetes?
Answer: Containerized workloads and services are managed with Kubernetes, an open-source platform that allows declarative configuration and automated deployment. Kubernetes allows users to create multiple container instances to improve fault tolerance. Jenkins can use the Kubernetes deploy plugin for continuous deployment.
34. Have you run automated tests on Jenkins? How is it done?
Answer: The process is easy. You can run automated tests using Selenium or Maven. Moreover, the developers can plan out the tests. Using Jenkins, developers can view the test results and receive a report.
35. What is the use of the JENKINS HOME directory?
JENKINS_HOME directory contains all settings, logs, and configurations.
36. What is a trigger? Give an example of how the repository is polled when a new commit is detected.
Answer: Triggers determine when and how pipelines should be executed. Jenkins can poll a repository every time a commit occurs when integrated with an SCM tool, such as Git.
- Install and set up the Git plugin first.
- Afterward, you can create a trigger that specifies when a new build is to take place. For example, you can create a job that polls the repository and runs a build whenever a change is made.
37. What is a backup plugin? Why is it used?
Answer: This plugin backs up all the critical settings and configurations so they can be used in the future. It's useful in cases of failures so that the settings are not lost.
38. How do you define parameters for a build in Jenkins?
Answer: To execute a build, several input parameters are required. For example, if you have multiple test suites but only want to run one, you can set a parameter to select which one to run. For parameters to be integrated into a job, they must be specified in the parameter description. Any possible parameter can be used, such as a string, a file, or custom.
39. What are the ways to configure the Jenkins node agent to communicate with the Jenkins master?
Answer: Node agent can be launched in two ways:
- Browser – When the Jenkins node agent is launched from a browser, a JNLP (Java Web Start) file is downloaded. On the client machine, this file launches a new process to run jobs.
- Command-line – For the client to run the node agent, they require an executable file called agent.jar. Running this file launches a process on the client to connect to the Jenkins master and run build jobs.
40. Explain DSL Jenkins?
Answer: Jenkins DSL (Domain Specific Language) is a plugin that allows jobs to be defined programmatically and in a way that is human readable. By using this plugin, the UI configurations are translated into code intuitively. Thus, you can create a version of the job and also maintain a history of the changes. The converted code is written in Groovy. For example, if you have a parameter definition as below in the config.xml file:
<defaultValue>Welcome to Hackr.io</defaultValue>
The corresponding code will look like:
stringParam('MESSAGE', 'Welcome to Hackr.io')
41. What are the types of jobs or projects in Jenkins?
Answer: Jenkins has the following types of jobs and projects:
- Freestyle project
- Maven project
- Multibranch Pipeline
- External Job
- Multi-configuration project
- Github organization
42. What is the blue ocean in Jenkins?
Answer: This project aims to redesign the user experience of Jenkins, modeling and presenting the software delivery process through surfacing information that is important to development teams. It can be done with a few clicks as possible, while still preserving Jenkins' extensibility. The project is still at an alpha stage, but Jenkins users will be able to install Blue Ocean side-by-side with the Jenkins Classic UI via a plugin.
43. What is Continuous Testing?
Answer: The Continuous Testing process involves executing automated tests as part of the software delivery pipeline. In this way, you receive early feedback on the business risks involved with software. It includes evolving and extending test automation to deal with the increased complexity and pace of modern application development and delivery.
Testing takes place continuously without interruption of any kind in continuous testing. In a Continuous DevOps process, software changes are constantly moved from Development to Testing to Deployment. The code undergoes constant development, delivery, testing, and deployment.
44. How do you create a Multibranch Pipeline in Jenkins?
Answer: With the Multibranch Pipeline project type, you can implement different Jenkins files for different branches of a single project. Jenkins discovers, manages, and executes Pipelines in a Multibranch Pipeline project for branches containing Jenkins files.
45. Name a Jenkins environment variable you have used in a shell script or batch file.
Answer: Numerous environment variables are available by default in any Jenkins build job. Here are a few commonly used ones:
It is important to note that more Jenkins environment variables become available with each new Jenkins plug-in configured. For example, upon installing the Jenkins Git plug-in, new Jenkins Git environment variables are created, such as $GIT_COMMIT and $GIT_URL, which can be used in scripts.
46. How can you temporarily turn off Jenkins security if the administrative users have locked themselves out of the admin console?
Answer: There is a file named config.xml in the JENKINS_HOME folder. Whenever you enable the security, the useSecurity XML element in this file changes to true. When Jenkins is restarted, security will be disabled if this setting is set to false.
Nevertheless, disabling security should always be a last resort and a temporary measure. Once you have resolved the authentication issues, re-enable Jenkins security and reboot the CI server.
47. Explain the difference between Continuous Integration, Continuous Delivery, and Continuous Deployment?
Answer: Continuous integration: The process of constantly integrating the changes into the main software during all stages of the delivery pipeline, once the changes have been tested in the test environment. CI is also known as the work performed by the Jenkins or Bamboo servers.
Continuous delivery: Code is delivered (shipped) to an environment like test, integration, or production through a manual release.
Continuous deployment: It is the automatic release of code into staging or production environments after it has been tested in the CI stage.
48. What is Agent Directive in Jenkins?
Answer: Jenkins will use the agent directive to determine how and where to execute the Pipeline or subsets of it. Agents are required for all pipelines. An agent creates a workspace that contains the checkout files from source control and any additional working files required for the Pipeline. Jenkins will also perform the steps required for execution if there is an available executor.
49. What do you mean by Pipeline as a Code?
Answer: Pipeline-as-code is a method or a set of features that you can utilize to maintain CI/CD workflow logic in the Jenkins source repository without configuring Jenkins branches separately. The following applies to projects with a file named Jenkinsfile (containing pipeline scripts) in their root folder. There are two types of pipeline syntax: declarative and syntax.
- Declarative: It provides an easy way to create pipelines and has a predefined hierarchy for creating Jenkins pipelines. It is possible to control every aspect of the Pipeline.
- Scripted: It runs on Jenkins master via a lightweight executor, which uses few resources to translate the Pipeline into code (commands).
50. How to secure Jenkins?
Answer: Jenkins can be secured and configured globally through the following steps:
- Start Jenkins by deploying the Jenkins.war file to the server.
- Click Manage Jenkins on the homepage (via URL).
- Click 'Setup Security on this page.
- Make sure 'Enable Security' is checked.
- For security reasons, it is a good practice to have a database. Click the 'Allow users to sign up' checkbox in the 'Security Realm' option.
- Fill out the signup form. Once the signup is complete, you can log in with your new account.
- Next, go to Manage Jenkins and select 'Configure Global Security. Uncheck the 'Allow users to register box. By doing so, unauthorized users cannot be added.
- You can now configure the account authentication. In terms of security, two strategies exist matrix security and project authorization. It is up to you to decide which suits you best.
- Please save the form and log out before logging in with your new account.
If you have made it this far, then certainly you are willing to learn more about automation. Here are some more resources related to automation that we think will be useful to you.