35+ Most Popularly Asked Jenkins Interview Questions & Answers
Last updated on 24th Jun 2020, Blog, Interview Questions
Jenkins is a free and open source automation server. It helps automate the parts of software development related to building, testing, and deploying, facilitating continuous integration and continuous delivery. It is a server-based system that runs in servlet containers such as Apache Tomcat.Jenkins is used to build and test your software projects continuously making it easier for developers to integrate changes to the project, and making it easier for users to obtain a fresh build.
1. What is Jenkins?
Jenkins is an open source application developed for CI (continuous integration. and delivery using java language.
2. What are the benefits of using Jenkins?
- Jenkins can act as a tool for both CI and CD.
- The pipeline helps in identifying the problem in the project uickly and efficiently using LDAP email.
3. What are other tools like Jenkins?
4. What is CI?
Continuous Integration (CI) is defined as Building software and taking it through as many tests as possible with every change.
5. How Jenkins helps in CI?
Jenkins can integrate with various version control systems and check for the build with every change in the code.
6. What are plugins in Jenkins?
Plugins are the primary means of improving the functionality of a Jenkins environment to suit organization or user specific needs.
7. How many ways plugins can be installed in Jenkins?
There are two ways to install plugins in jenkins
8. What are the ways plugins can be installed in jenkins?
- Using the “Plugin Manager” in the wen UI
- Using the Jenkins CLI install-plugin command.
9. What are the few useful plugins in Jenkins?
There are almost 100s of plugins in Jenkins few important plugins include.
- Build monitor
10. Is it possible to install a custom plugin on my own?
Yes it is possible to install a custom plugin.
11. How do I remove a plugin from Jenkins?
To uninstall a plugin do the following:
- Go to Manage Jenkins → Manage plugins.
- Click on the Installed tab.
- Some of the plugins will have an Uninstall option.
12. What is the requirement for using Jenkins?
Minimum hardware requirements for Jenkins Usages is : 256 MB of RAM. 1 GB of drive space.
13. Difference between Jenkins and Maven?
- Maven is a build tool, in short, a successor of ant.
- It helps in build and version control
- Jenkins is a continuous integration system, where maven is used for build.
- Jenkins can be used to automate the deployment process
14. What is a job in Jenkins?
A Jenkins project is a repeatable build work that contains steps and post builds activities. The kinds of activities you can perform in a build step or post-build activity are very constrained.
15. What is a downstream job in Jenkins?
A downstream activity is an arranged project that is activated as a feature of an execution of a pipeline.
16. What is an upstream job in Jenkins?
An upstream activity is an arranged project that triggers a project as of its execution.
17. What is a build process?
An upstream activity is an arranged project that triggers a project as of its execution.
18. What is the Jenkins Pipeline?
Jenkins Pipeline is a mix of modules that help the mix and usage of ceaseless conveyance pipelines utilizing Jenkins.
19. What are the different types of Jenkins pipeline?
A Jenkins file can be written using two types of syntax – Declarative and Scripted.
20. What are Declarative Pipelines?
Declarative pipeline linguistic structure offers a simple method to make pipelines. It contains a predefined progressive system to make Jenkins pipelines. It enables you to control all parts of a pipeline execution in a basic, clear way.
21. What are Scripted Pipelines?
Scripted Jenkins pipeline keeps running on the Jenkins ace with the assistance of a lightweight agent. It utilizes not many assets to make an interpretation of the pipeline into nuclear directions. Both declarative and scripted language structure is unique in relation to one another and are characterized absolutely in an unexpected way.
22. What is the default port in Jenkins?
The default port in Jenkins in 8080
23. How to change the running port in Jenkins?
Using the CLI and running java -jar Jenkins.war –httpPort=8282 can change the default port.
24. How to change the port in Linux?
Edit the file in the default directory /etc/default/Jenkins. And change the HTTP_PORT= 8001 and restart.
25. Describe Master-Slave architecture in Jenkins.
Jenkins underpins the master-slave design, numerous slaves work for a master. It is otherwise called Jenkins Distributed Builds. It additionally enables you to run occupations on various situations like Linux, macOS, Windows, etc. We can likewise run a similar experiment on various conditions in parallel utilizing Jenkins Distributed Builds, which thus causes you to accomplish the ideal outcomes rapidly utilizing this dispersed methodology. The majority of the activity results are gathered and consolidated on the master hub for observing.
26. What are tasks performed by a Master?
- Scheduling build jobs.
- Dispatching builds to the slaves for the execution.
- Monitor the slaves.
- Recording and presenting the build results.
- It can also execute build jobs directly.
27. What are the Characteristics of a Slave?
- It hears demands from the Jenkins Master case.
- Slaves can keep running on an assortment of working frameworks.
- The activity of a Slave is to do as they are advised to, which includes executing fabricate occupations dispatched by the Master.
- We can arrange an undertaking to dependably keep running on a specific Slave machine or a specific sort of Slave machine, or essentially let Jenkins pick the following accessible Slave.
28. Why Jenkins and Selenium?
- Running Selenium tests in Jenkins enables you to run your tests each time your software changes and send the software to another environment when the tests pass.
- Jenkins can plan your tests to keep running at explicit time.
- You can spare the execution history and Test Reports.
29. What is Jenkins CLI?
Jenkins has a worked in direction line interface that enables you to get to Jenkins from the content or from your shell. This is helpful for mechanization of routine errands, mass updates, inconvenience determination, etc. This interface is gotten through the Jenkins CLI customer, which is a Java JAR document disseminated with Jenkins.
30. What is a Jenkins Workspace?
Jenkins has a worked in direction line interface that enables you to get to Jenkins from the content or from your shell. This is helpful for the computerization of routine errands, mass updates, inconvenience analysis, etc. This interface is gotten to by means of the Jenkins CLI client, which is a Java JAR file circulated with Jenkins.
Get Advanced Practices on Jenkins Training from Real Time Experts
- Instructor-led Sessions
- Real-life Case Studies
31. What is matrix-based security?
Matrix-based security is one of the approval techniques accessible for verifying Jenkins. It enables you to give explicit consent to clients and gatherings. The accessible authorizations are recorded beneath with their portrayals and are additionally accessible by floating over the consent heading in the Jenkins UI.
32. Can we delete the workspace?
Yes we can delete the workspace.
34. What are the Features of Jenkins?
- Easy Upgrade
- Open Source (Free.
- Easily Build Pipeline Support
- Configuration Setup is Very Easy
35. What are the Important Plugins in Jenkins
- HTML Publisher
- Green Balls
- Amazon EC2
36. What command is Used for Start Jenkins?
- Start with Command Prompt
- D:\>Java –jar Jenkins.war
- Type the above command and Start the Jenkins
37. What are Scripted Pipelines in Jenkins?
Scripted Pipelines is Given by the Below Syntax
38. What are all Jenkins Supported SCM Tools
- What are the CT tools Used in Jenkins
GitLab CI,Go CD,Bamboo,Jenkins,Travis CI,,CircleCI, Codeship, TeamCity
The Above mentioned tools are common Ct tools Used in Jenkins.
39. What is the Flow Control in Jenkins
In Jenkins Flow control follows the pipeline scripted pipeline that are being implemented from the top to bottom of the Jenkins file.
40. What are the ways in which the build can be scheduled in Jenkins?
- After the finishing of different forms.
- By source code, the executives (adjustments. submit.
- At a particular time.
- By mentioning manual forms.
41. What are the ways Jenkins server security?
- To protect Jenkins from a user with local access, the Configuration of Jenkins_Home is good.
- Protect Jenkins’s master from malicious build agents- Master-Slave Architecture.
42. Most Artifactory repository tool used in DevOps Culture?
Nexus, JFrog, and s3- The purpose of the artifactory is that we can create our own repository to maintain multiple versions of the delivery of the project.
43. What is the Jenkins Home directory?
Default. Jenkins local folder
44. How to delete old builds automatically?
Discard Old Build option is used
45. How to Configure passwordless authentication on the Jenkins?
Slave server for the Jenkins user launch Slave agent via SSH
46. How to install Jenkins in a local home directory with non root access in Linux?
With the use of PREFIX to configure to install Jenkins it into your home directory with non root access in Linux
47. What is a Cron Job?
Cron Expression is a utility to schedule job periodically as per the user requirement in Jenkins
48. How to write the shell script command to deploy or move the ant build war file to destination folder
select SH shell script and give like below. cp -r “source path” “destination path”
49. What are Parameters in Jenkins?
Parameters are supported by the Agent section and are used to support various use-cases pipelines. Parameters are defined at the top-level of the pipeline or inside an individual stage directive.
50. What is name of the file used for defining the Jenkins Pipeline
Jenkins File is used for Jenkins Pipeline which is a text file
Best Advanced Jenkins Courses & Get Noticed By Top Hiring CompaniesWeekday / Weekend BatchesSee Batch Details
51. What are the different stages in Jenkins File?
Build, Test, Deploy
52. What is stage and step in Jenkins Pipeline’s file stage describes a stage of this Pipeline.
The stage describes a stage of this Pipeline whereas steps describe the steps to be run in this stage
53. How a Pipeline script can be created?
A script can be directly entered in the Jenkins web UI or by creating a Jenkinsfile
54. What is a Snippet Generator?
Snippet Generator is a utility for creating bits of code for individual steps provided by the plugin and it is dynamically populated with a list of the steps available to the Jenkins instance
55. How to handle failures using Jenkins?
FileThe Post Section in Declarative Pipeline supports robust failure handling by default
56. What do you mean by continuous integration?
Continuous integration is testing each piece of code developed by developers and giving immediate feedback to the developer.
57. Where do we install Jenkins?
Jenkins can be installed in any OS and any infrastructure platform.
58. Advantages of Jenkins?
- caching of build failures
- One place reference for all the project activities
- Automatic mail notification
- Automatic build and deployment
- wider visibility
59. How to copy Jenkins job from one server to another server?
In Jenkins home folder there is a folder named “jobs”, copy the respected job to the target server
60. Ways to restart Jenkins?
we can do a force restart and a safe restart of the Jenkins instance
61. Useful plugins in Jenkin?
- git integration
- build pipeline
- extended email notifier
62. How to install a custom plugin in Jenkins?
go to manage plugins –>upload plugin –> choose .hpi file to upload the custom plugin
63. How can we create a backup of Jenkins?
Jenkins stores everything in its home folder, creating a copy of it will create a backup
64. Can we provide a custom workspace in Jenkins?
yes we can provide custom workspace in Jenkins
65. How can you create a new job in Jenkins?
Goto Jenkins dashboard –> new item –> choose the type of job –> create
66. Can we create the Jenkins build configuration as a script?
yes we can create using the pipeline script /Jenkinsfile
67. What is the difference between Hudson and Jenkins?
There is no difference between Hudson and Jenkins. Hudson was the former name of Jenkins, after going through several issues the name was changed to Jenkins.
68.What is Groovy in Jenkins?
- Groovy is the default scripting language that is being used in the development of JMeter Version 3.1.
- Currently Apache Groovy is the dynamic object-oriented programming language that is used as a scripting language for the Java platform. Apache Groovy comes with some useful features such as Java Compatibility and Development Support.
69. What is Jenkinsfile?
The text file where all the definitions of pipelines are defined is called Jenkinsfile. It is being checked in the source control repository.
70. Which CI Tools are used in Jenkin?
Jenkins supported the following CI tools:
- GitLab CI
- Travis CI
- Go CD
71. Which commands can be used to start Jenkins manually?
You can use the following commands to start Jenkins manually:
- (Jenkins_url)/restart: To force restart without waiting for build completion.
- (Jenkin_url)/safeRestart: Waits until all the build gets completed before restarting
72. Which Environmental Directives are used in Jenkins?
Environmental Directives is the sequence that specifies pairs of the key-values called Environmental Variables for the steps in the pipeline.
73. What are Triggers?
Trigger in Jenkins defines the way in which the pipeline should be executed frequently. PollSCM, Cron, etc are the currently available Triggers
74. What is Agent Directive in Jenkins?
The Agent is the section that specifies the execution point for the entire pipeline or any specific stage in the pipeline. This section is being specified at the top-level inside the pipeline block.
75. How to make sure that your project build does not break in Jenkins?
You need to follow the below-mentioned steps to make sure that the Project build does not break:
- Clean and successful installation of Jenkins on your local machine with all unit tests.
- All code changes are reflected successfully.
- Checking for repository synchronization to make sure that all the differences and changes related to config and other settings are saved in the repository.
76. How will you define Post in Jenkins?
Post is a section that contains several additional steps that might execute after the completion of the pipeline. The execution of all the steps within the condition block depends upon the completion status of the pipeline.
77. Explain the terms Agent, post-section, Jenkinsfile
- Agent: It is a directive to tell Jenkins to execute the pipeline in a particular manner and order.
- Post-section: If we have to add some notification and to perform other tasks at the end of a pipeline, post-section will definitely run at the end of every pipeline’s execution.
- Jenkinsfile: The text file where all the definitions of pipelines are defined is called Jenkinsfile. It is being checked in the source control repository.
78. How can You Clone a Git Repository via Jenkins?
- To create a clone repository via Jenkins you need to use your login credentials in the Jenkins System.
- To achieve the same you need to enter the Jenkins job directory and execute the git config command.
79. How can you secure Jenkins?
Securing Jenkins is a little lengthy process, and there are two aspects of securing Jenkins:
- Access Control which includes authenticating users and giving them an appropriate set of permissions, which can be done in 2 ways.
- Security Realm determines a user or a group of users with their passwords.
- Authorization Strategy defines what should be accessible to which user. In this case, there might be different types of security based on the permissions granted to the user such as Quick and simple security with easy setup, Standard security setup, Apache front-end security, etc.
- Protecting Jenkins users from outside threats.
80. What is the solution if you find a broken build for your project?
To resolve the broken build follow the below-mentioned steps:
- Open console output for the build and check if any file change has missed.
- Clean and update your local workspace to replicate the problem on the local system and try to resolve it (In case you couldn’t find out the issue in the console output)
81. What are the basic requirements for installing Jenkins?
For installing Jenkins you need the following system configuration:
- Java 7 or above.
- Servlet 3.1
- RAM ranging from 200 MB to 70+ GB depending on the project build needs.
- 2 MB or more of memory.
82. Why is Jenkins called a Continuous Delivery Tool?
We have seen the Continuous Delivery workflow in the previous question, now let’s see the step by step process of why Jenkins is being called as a Continuous Delivery Tool:
- Developers work on their local environment for making changes in the source code and push it into the code repository.
- When a change is detected, Jenkins performs several tests and code standards to check whether the changes are good to deploy or not.
- Upon a successful build, it is being viewed by the developers.
- Then the change is deployed manually on a staging environment where the client can have a look at it.
- When all the changes get approved by the developers, testers, and clients, the final outcome is saved manually on the production server to be used by the end-users of the product.
In this way, Jenkins follows a Continuous Delivery approach and is called the Continuous Delivery Tool.
83. How did Jenkins come into existence?
Originally called Hudson, Jenkins came into existence when Oracle took over the ownership to continue development of the product, by renaming it as Jenkins.
84. How is continuous integration achieved using Jenkins?
Here are the steps
- All the developers commit their source code changes to the shared Git repository.
- Jenkins server checks the shared Git repository at specified intervals and detected changes are then taken into the build.
- The build results and test results are shared to the developers
- The built application is displayed on a test server like Selenium and automated tests are run.
- The clean and tested build is deployed to the production server.
85. Do you know any other continuous integration tools? How is Jenkins better than any of those?
There are many other CI tools, the prominent ones being
- Circle CI
- Travis CI
86. What is DevOps and in which stage does Jenkins fit in?
DevOps is a software development practice which blends software development (Dev) with the IT operations (Ops) making the whole development lifecycle simpler and shorter by constantly delivering builds, fixes, updates, and features. Jenkins plays a great role because it helps in this integration by automating the build, test and deployment process.
87. What are the system requirements to install Jenkins?
The minimum configuration required is
- 256MB of RAM
- 1 GB of drive space
- Web browser
88. Can you start Jenkins using the command line? How?
Yes, using jenkins.exe start
89. Give a simple use case/scenario to explain how Jenkins works.
- Let us say a developer is working on some code changes and eventually commits them to the repository.
- Jenkins server, which constantly checks for changes in the repository, detects the change and pulls the changes to trigger a build.
- The build can fail, in which case the developer is informed with reports.
- If the build passes, it is deployed onto the test server.
- Once the testing is complete, a test report is generated and sent to the developers. This process continues till all the tests are successful, after which code is deployed to production.
90. Explain how you can move or copy Jenkins from one server to another?
- Slide a job from one installation of Jenkins to another by copying the related job directory
- Make a copy of an already existing job by making clone of a job directory by a different name
- Renaming an existing job by renaming a directory.
91. Explain how you can deploy a custom build of a core plugin?
To deploy a custom field of a core plugin, you have to do following things
- Stop Jenkins
- Copy the custom HPI to $Jenkins_Home/plugins
- Delete the previously expanded plugin directory
- Make an empty file called <plugin>.hpi.pinned
- Start Jenkins
92. Mention what are the two components Jenkins is mainly integrated with?
Jenkin is mainly integrated with two components
- Version Control system like GIT, SVN
- And build tools like Apache Maven.
93. Define the process of Jenkins.
- First, a developer commits the code to the source code repository. Meanwhile, the Jenkins server checks the repository at regular intervals for changes.
- Soon after a commit occurs, the Jenkins server detects the changes that have occurred in the source code repository. Jenkins will pull those changes and will start preparing a new build.
- If the build fails, then the concerned team will be notified.
- If the build is successful, then Jenkins deploys the build in the test server.
- After testing, Jenkins generates feedback and then notifies the developers about the build and test results.
- It will continue to check the source code repository for changes made in the source code and the whole process keeps on repeating.
94. What are the pre-requisites for using Jenkins?
The answer to this is pretty straightforward. To use Jenkins you require:
- A source code repository which is accessible, for instance, a Git repository.
- A working build script, e.g., a Maven script, checked into the repository.
95. What is the use of Pipelines in Jenkins?
Pipeline plugin is used in Jenkins for making the Jenkins Pipeline, which gives us the view of stages or tasks to perform one after the other in the pipeline form. It models a series of related tasks. Pipelines help the teams to review, edit and iterate upon the tasks. Pipelines are durable and it can optionally stop and wait for human approval as well to start the next task. A pipeline is extensible and can perform work in parallel. It supports complex CD requirements.
96. Do you know about cloud computing? How can Jenkins fit into a cloud computing environment? Explain with an example.
Let us take the example of AWS cloud service. Cloud computing services use the CI/CD model so that they can push their work to the customers and constantly receive feedback. Jenkins is used to automating the CI/CD pipelines. For example, a lot of Jenkins plugins are available for many of the AWS services like Amazon EC2 and ECS.
97. What is Kubernetes? How can you integrate Jenkins with Kubernetes?
Kubernetes is a container orchestration tool. With Kubernetes, one can create multiple container instances to achieve more fault tolerance. You can use the Kubernetes deploy plugin to use it with Jenkins for continuous deploy.
98. Have you run automated tests on Jenkins? How is it done?
Yes, this can be done easily. Automated tests can be run through tools like Selenium or maven. Developers can schedule the test runs. Jenkins displays the test results and sends a report to the developers.
99. Let us say, you have a pipeline. The first job was successful, but the second failed. What should you do next?
You just need to restart the pipeline from the point where it failed by doing ‘restart from stage’.
100. Give an example of how the repository is polled when a new commit is detected.
When Jenkins is integrated with an SCM tool, for example, Git, the repository can be polled every time there is a commit.
- The Git plugin should be first installed and set up.
- After this, you can build a trigger that specifies when a new build should be started. For example, you can create a job that polls the repository and triggers a build when a change is committed.