Top 100 Jenkins Interview Questions and Answers

Jenkins is a popular DevOps open source automation server. If you are looking forward to becoming a DevOps Engineer then this is what you need. Its job is to automate the non-human part of software development and supports continuous integration and continuous delivery.

Here are the set of Jenkins Interview questions that might help you meet and realize your goals. Let’s go through some most important Jenkins interview questions.  

Table of Contents

1. What is Continuous Integration in Jenkins?

In Jenkins interview questions this is the most common question. Continuous Integration tool is a development method in which developers are expected to contribute changes to source code frequently using a common repository.

 

Continuous Integration Process

2. What is Jenkins?

This is the basic question asked in Jenkins’s interview. Jenkin is a Java-based open source continuous integration tool with plugins written in Java. 

It is a tool written in Java hence it is portable to all major platforms 

3. What is a Jenkins Pipeline: 

One of the top Jenkins interview questions is about the Jenkins pipeline. 

It is a collection of plugins that let you set up and use a continuous delivery pipeline in Jenkins.

4. What is Groovy in Jenkins?

This is among the most common interview questions. 

The default programming language utilized in the creation of JMeter version 3.1 is Groovy. 

5. Difference between maven ant and jenkins?

A maven is a build tool, in short, the successor of ant. It helps in build and version control. However, Jenkins is a continuous integration system, wherein maven is used for building. 

6. Which SCM tools Jenkins supports? 

Below are the source code management tools supported by Jenkins :

  • Accurev
  • CVC
  • Subversion
  • Git
  • Mercurial 
  • Perforce
  • Clearcase
  • Rtc

7. What is the relation between Hudson and Jenkins?

Jenkins is actually a renamed version of Hudson.

 It was forked from Hudson when Sun was acquired by Oracle who aimed to develop a commercial version of the software. 

See also  Top 100 Hive Interview Questions And Answers

8. How to make sure that your project builds do not break in Jenkins? 

To make sure the build is not broken in the slightest degree we perform a successful clean install on the local machine with all unit tests. 

Then all the source code management changes are checked.

Then synchronize with a repository to make sure that all needed config and changes and any variations are checked into the repository. 

9. How to move or copy Jenkins from one server to another: 

This is an advanced Jenkins interview question.

  • Copy all the files in your JENKINS_HOME directory over to the new server.
  • Point JENKINS_HOME on the new server at the new directory.
  • Copy the Jenkins war file over to the new machine and start it up. 

All Jenkins settings, jobs, plugins, config, etc. live in JENKINS_HOME. You just need a copy of that to start it elsewhere. 

 10. How can we create a backup and copy files in Jenkins?

To create a backup all you need to do is to periodically back up your JENKINS_HOME directory. 

To create a backup of your Jenkins setup, just copy this directory.

You can also copy a job directory to clone or replicate a job or rename the directory. You can create a cron job to do so, or you can use the “Thin Backup” plugin in Jenkins. 

11.  How can you clone a git repository via Jenkins? 

To create a clone repository you need to use your login credentials in the Jenkins system. 

To achieve the same you need to enter into the Jenkins job directory and execute the git config command. 

12.  What is the difference between smoke and sanity testing?

Smoke TestingSanitary Testing
The motive here is to measure the stability of the newly created build of a core to face off more rigorous testingThe primary purpose here is to evaluate and validate the rationality and originality of the functionalities of software build of a core

13.  How to reset Jenkins username and password?

You can simply disable the security in the config.xml file. 

  • If Jenkins is running on the Linux OS, edit the below file. vi/var/lib/jenkins/config.xml file.
  •  Search for the word<useSecurity>true</useSecurity> and change the word true to false.
  • Restart the Jenkins server – service jenkins restart. 
  • Now go to the Jenkins portal again and Jenkins will not ask for any credential this time.
  •  Go to “Manage Jenkins” to set the administrator password again. 
  • Enable the security again by changing settings to <useSecurity>true</useSecurity> and restart the Jenkins again. 

Note: If your Jenkins is running on Windows OS, config.xml file located in C:\Program Files(x86)\Jenkins\folder. 

  14.  How do you set up the Maven project in Jenkins?

  • Execute windows commands
  • Invoke top-level maven targets
  • Trigger maven build using maven integration plugin

15.  How do you start Jenkins? 

To start from the command line :

  • Open command prompt 
  • Go to the job directory where your war file is placed and run the following command: java-jar jenkins.war

 16. How to create a job in Jenkins? 

  • Go to the Jenkins dashboard and click on new item
  • In the next screen, enter the item name 
  • The following screen will come up in which you can specify the details of the job. 
  • We need to specify the locations of the file which needs to be built 

17.  What are the useful plugins in Jenkins? 

It is one of the most asked Jenkins interview questions

  • Amazon EC2 html publisher
  • Maven Integration: This provides a deep integration of Jenkins and Maven.
  • Git Plugin: Integrates Git with Jenkins.
  • TestNG Results Plugin: Integrates TestNG test reports to Jenkins.
  • HTML Publisher plugin: Publishes HTML reports.
  • Email Extension: It is a replacement for Jenkin’s email publisher. 
  • Email Extension Template Plugin: Allows administrators to create global templates for the extended email publisher. 
  • External Monitor Job type plugin: Adds the ability to monitor the result of externally executed jobs.
  • Artifact join green balls: Green is better than blue! For colour blind support configure user property.

18.  On which platform Jenkins will work? 

It is built with Java and hence it is portable to all the major platforms.

19.  What are commands you can use to start Jenkins? 

To start Jenkins manually, you can use either of the following: 

  • (Jenkins_url)/restart : forces a restart without waiting for builds to complete. 
  • (Jenkins_url)/safeRestart: allows all running builds to complete. 

20.  What are the  two components Jenkins is mainly integrated with? 

  • Version control system like GIT, SVN.
  • Build tools like Apache Maven.

 21.  What is a  trigger? Give an example of how the repository is polled when a new commit is detected. 

Trigger in Jenkins defines the way in which the pipeline should be executed frequently. PollSCM, Cron, etc are the currently available triggers.

A repository can be polled every time there is a commit. 

The core plugin in Jenkins should be first installed and set up, after this, you can build a trigger that specifies when a new build should be started. 

22.  What is the difference between Jenkins and Bamboo? 

difference between Jenkins and Bamboo

23.  Define the process of Jenkins

  • Commit the changes 
  • Detect source code changes
  • The build either passes or fails
  • Generate feedback 
Jenkins process

24.  What are the benefits of using Jenkins ? 

  • Cache build failures
  • Automatic build report notification
  • Achieves continuous integration 
  • Automation of maven project 
  • Easy tracking of bugs 

25.  What are the prerequisites of using Jenkins? 

  •  A source code repository which is accessible, for example, a Git repository
  • A working build script, e.g, a Maven script, checked into the repository 

26.  How do you install Jenkins ? 

  • Install Java version 8 
  • Install Apache Tomcat Version 9 
  • Downloads Jenkins war File 
  • Deploy Jenkins war File 
  • Install suggested plugins

27.  What is Maven? What is the benefit of integrating Maven with Jenkins? 

Maven is a build management tool. 

It uses a simple pom.xml to configure all the dependencies needed to build, test, and run code.

28.  How will you define Post in Jenkins? 

Post is a section that contains several additional steps that might be executed after the completion of the pipeline. 

29.  What are parameters in Jenkins? 

Parameters are supported by the Agent section and are used to support various use-case pipelines. 

30.  How can you clone a repository via Jenkins? 

  • Enter email and username 
  • Now execute the command git config

31.  How will you secure Jenkins? 

  • Authentication 
  • Authorisation 
  • Security Realms 
  • Role based access control 

32. Explain how you can deploy a custom build of core plugin.

  • Stop Jenkins.
  • Copy the custom HPI to $Jenkins_Home/plugins. 
  • Delete the previously expanded plugin directory. 
  • Make an empty file called <plugin>.hpi.pinned. 
  • Restart Jenkins. 

 33. What do you do when you see a broken build for your project in Jenkins? 

 Open the console output for the broken build and try to see if any file  changes are missed. 

 34. What are the various ways in which builds can be scheduled in Jenkins? 

  •  SCM commits
  • Completion of other builds 
  • Run at a specified time
  • Manual build requests

35.  Explain the terms Agent, post-section, Jenkinsfile. 

  • Agent: directive to tell Jenkins to execute the pipeline in a particular manner and order. 
  • Post-section: needed to add some notification and to perform other tasks at the end of the pipeline. 
  • JenkinsFile: text file where all the definitions of pipelines are defined. 

36. Do you know about cloud computing? How can Jenkins fit into a cloud computing environment? 

Cloud computing is the on-demand availability of computer system resources, especially data storage and computing power, without direct active management by the user. 

37. What is Kubernetes? Can it be used with Jenkins? 

Kubernetes is a container orchestration tool. With Kubernetes, one can create multiple container instances to achieve more fault tolerance.

38. Is it possible to run automated tests on Jenkins? 

Automated tests can be run through tools like selenium or maven developers can schedule deep tests to run and Jenkins displays the test result and sends a report to the developers.

39. Let us say you have a pipeline. The first job was successful, but the second failed. What should you do next? 

Restart the pipeline from the point where it failed by doing the restart from the stage.

40. What is the use of the JENKINS HOME directory? 

All the settings, logs, and configurations are stored in the JENKINS_HOME directory. The JENKINS HOME directory contains all the details of your Jenkins server configuration details that you configure in the managed Jenkins screen,  these configuration details are stored in the form of a set of XML files. 

See also  Top 50 SSRS Interview Questions and Answers

41.  What is a backup plugin? Why is it used? 

This is a helpful plugin that backs up all the critical settings and configurations to be used in the future. This is useful in cases where there is a failure so that we don’t lose the settings. 

42.  How do you define parameters for build in Jenkins? 

 A build can take several input parameters to execute. For example, if you have multiple test suites, but you only want to run only one. 

43.  What are the ways to configure Jenkins node agent to communicate with Jenkins master? 

There are two ways to start the node agent:

  • Browser –  if a Jenkins node agent is launched from a browser jnlp that is Java Web Start file is downloaded. This file launches a new process on the client machine to run these jobs.
  •  Command line – to start the node agent using the command line the crying needs an executable agent or jar file. When this file is run it simply launches a process of the client to communicate with the Jenkins masters to run the Bell jobs. 

44.  How does Jenkins authenticate users ? 

There are 3 ways:-

  • Default way: It store the user data and the credentials in an internal database 
  • Application server: Configure Jenkins to use the authentication mechanism defined by the application server on which it is deployed.
  • LDAP server: Configure Jenkins to authenticate against LDAP server 

45.  How can you use a third party tool in Jenkins? 

  • Install a third party software 
  • Download the required plug-in
  • Configure third party tool in the admin console 
  • Use the required plugin from the Jenkins build job for different third party tools 

46.  What are the types of pipelines in Jenkin? 

There are three types of pipeline : 

  •  CI CD pipeline (Continuous Integration Continuous Delivery) 
  • Scripted Pipeline 
  • Declarative Pipeline 

47.  What syntax does Jenkins use to schedule build jobs or SVN polling? 

Cron syntax is represented using five asterisks each separated by a space. 

cron syntax

48.  What is DevOps and in which stage does Jenkins fit in?

DevOps is a software developing practice that blends software development (Dev) with IT operations (Ops) making the whole development lifecycle simpler and shorter by constantly delivering builds, fixes updates, and features. 

49.  Do you know any other Continuous integration tools? How is Jenkins better than any of those? 

  • Team city 
  • Bamboo
  • Perforce
  • Circle CI 
  • Go
  • ThoughtWorks 
  • Integrity
  • Travis CI 

It would not be fair to say that Jenkins is better than any other tool because each has its own unique features for instance Team city offers great dotnet support but it is complex and costly. 

Travis CI is free just like Jenkins and has good documentation. Bamboo offers efficient and faster bids but it is not completely free. 

50. Name a Jenkins environment variable you have used in a shell script or batch file.

One of the top Jenkins Interview Questions and Answers is to name environment variable:

  • $JOB_NAME
  • $NODE_NAME
  • $WORKSPACE
  • $BUILD_URL
  • $JOB_URL

51. How is Continuous Integration achieved using Jenkins?

Continuous Integration achieved using Jenkins

52. What is a DSL Jenkins?

The Jenkins “Job DSL / Plugin” is made up of two parts –  The Domain Specific Language(DSL) itself that allows users to describe jobs by using a GUI based language and a Jenkins plugin which manages the scripts and the updating of Jenkins job which are created and maintained as a result. 

53.  How do you create a Multibranch Pipeline in Jenkins? 

The multi-branch pipeline project type enables you to implement different Jenkinsfile for different branches of the same project. In a multibranch pipeline project, Jenkins automatically discovers, manages, and executes pipelines for branches that contain a Jenkins file in the source control.

54.  What are the types of jobs or projects in Jenkins?

  • Freestyle project
  • Maven project 
  • Pipeline 
  • Multibranch Pipeline 
  • External job 
  • Multi-configuration project 
  • Github organization 

55. What is the blue ocean in Jenkins? 

It is a project that was started with a purpose to rethink the user experience of Jenkins, modeling and presenting the process of software delivery by surfacing information that’s important to development teams. 

56. What do you mean by pipeline as a code? 

Pipeline as a Code describes a set of features that allow users to define pipelined job processes with code, stored and versioned in a source repository. 

57. What is Continuous Testing? 

It is the process where automated tests are executed as a part of the software delivery pipeline. 

58. How to integrate Git with Jenkins?

The below steps show you how to integrate Git with Jenkins:

  • Click on Manage Jenkins on the Jenkins dashboard.
Jenkins dashboard
  • Click on Manage Plugins.
Manage Plugins
  • In the plugins page, click on Git and select install without restart. 
plugins page
  • After this Manage Jenkins on Jenkins dashboard. There you will see this plugin installed.
Jenkins dashboard

59.  What is the difference between Continuous Delivery and Continuous Deployment? 

Continuous Delivery is a software development practice where you build software in that it can be released to the production at any time you achieve.

 In the Continuous Delivery workflow, you have manual deployment to production, so there is no need for every change to be deployed.

Continuous Deployment involves every change to be deployed automatically. Every change that you make goes through the pipeline and if it passes all the tests, it automatically gets deployed onto the production, delivery, and continuous deployment approach. 

60.  Explain Master-Slave architecture of Jenkins. 

Master-Slave architecture of Jenkins
  • Pulls the code from the remote Github repository every time there is a code commit.
  • It distributes the workload to all the Jenkins slaves.
  • On request from master, the slaves carry out builds and test the procedure test reports 

61.  What is a Jenkins file? 

It is a text file that contains the definition of a Jenkins Pipeline and is checked into the source control repository. 

  • Allows code review and iteration on the pipeline.
  • Permit audit trail for the pipeline.
  • There is a single source of truth for the pipeline which can be viewed and edited.

62.  What concepts are key concepts of Jenkins pipeline?

Jenkins Pipeline key aspects:

Pipeline: Pipeline’s code defines the entire build process, which includes building, testing, and delivering an application.

Node: A machine that is part of the Jenkins environment capable of executing a pipeline. 

Step: A single task that tells Jenkins what to do at a particular point in time.

Stage: Defines a conceptually distinct subset of tasks performed through the entire pipeline(build, test, deploy stages)

63.  Which file is used to define dependency in maven?

Pom.xml is used for defining dependency in maven.

64.  Explain  two types of pipeline in Jenkins.

 Scripted Pipeline: 

  • It is based on Groovy script as their Domain Specific language. 

  Declarative Pipeline: 

  • It provides a simple and friendly syntax to define a pipeline. Here pipeline block defines the work done throughout the pipeline.

65.  Name three security mechanisms Jenkins uses to authenticate users. 

  • Jenkins uses an internal database to store user data and credentials 
  • Lightweight Directory Access Protocol(LDAP) server can be used by Jenkins to authenticate users.
  • Jenkins can be configured to employ the authentication mechanism used by the application server upon which it is deployed.

66.  How can you temporarily turn off Jenkins security if the administrative users have locked themselves out of the admin console? 

  • When security is enabled, the Config file contains an XML element named useSecurity that will be set to true. 
  • By changing this setting to false, security will be disabled next time Jenkins is restarted. 

 67. What is Software Testing?

Software testing is the process of analyzing software to find out the bugs and to evaluate the features of the software to show that the software is performing correctly as it is intended to function without any error. 

68. What are the types of Software Testing?

There are two types of software testing:  

  • Functional testing includes unit testing, integration testing, interface testing, smoke testing, sanity testing, regression testing, regression testing and acceptance testing. 
  •  Non functional testing includes documentation testing, installation testing, performance testing, reliability testing and security testing. 
See also  Top 65 Apache Kafka Interview Questions And Answers

 69.  What is Software Build?

The software build, otherwise known as integration, is the process of taking all source code files that make up an application and compiling them into build artifacts, such as binaries or executables.

 70.  What is Smoke Testing?

 Smoke testing is one of the popular software testing services performed after software build to find if the critical functionalities of the program are working fine.

smoke testing

 71.  What is Sanity Testing?

Sanity testing is a special type of software testing performed after receiving a software build with little changes in code or functionality to ascertain that certain bugs have been fixed in advance to resolve workflow issues. 

sanity testing

72. Describe a few advantages of Jenkins.

  •  It saves developer time: 

Since most of the integration task is being handled by Jenkins the developer time is focussed on development activities mostly. 

  • Improved software quality: 

As the software is being tested immediately after any code check-in, it keeps the quality check frequently, thus improving overall software quality.

  • Faster Delivery: 

Jenkins automatically does continuous integration, which leads to very early detection of bugs/defects, and hence it leads to faster delivery of software. 

73. What are the two most important components Jenkins is integrated with?

  • Version Control System like SVN, GIT
  • Build tools like Maven

74.  What are the features of Jenkins? 

  • It is free and open source 
  • Easy installing on all operating system
  • Easy to use user interface
  • Build Pipelines

75. What is the requirement of using Jenkins? 

  • 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

76.  Any prerequisite for using Jenkin?

For using Jenkins, you need an accessible source code repository(SCR) and working built script too.

77.  How can you set up Jenkins jobs?

Follow these steps:

  • Select new item from menu
  • After that, enter a name for the job and select a free-style job.
  • Then click Ok to create a new job in jenkins.
  • The next page enables you to configure your job

78.  What to do if you check any broken build? 

If any broken build is found then check the local workspace immediately and try to fix it quickly. 

79.  Explain in detail about Scripted Pipeline.

A scripted pipeline is built on top of the underlying pipeline sub-system. It is effectively a general-purpose DSL built with Groovy. It can be a very expensive and flexible tool with which one can author continuous delivery pipelines. 

80. How can you write a simple jenkins Pipeline code for Java? 

Jenkinsfile(Declarative Pipeline) 
Pipeline { 
    agent { docker ‘maven:3.3.3’ }
    stages {
      stage(‘build’) {
         steps {
           sh ‘mvn --version’

81.  Name two ways a Jenkins node agent can be configured to communicate back with Jenkins master. 

It could be done by just going to the node machine, launching a browser, and then launching a Jenkins node from a browser using JNLP. 

82.  How do you take a backup of your Jenkins build jobs in order to prepare for disaster recovery? 

All you have to do is go into the jobs folder in Jenkins home, copy that jobs folder, you will have the configuration for all of the build jobs that are configured inside of your environment. It’s that job folder, copy it back up from time to time, even check into the store’s code repository. 

83.  Name three steps or stages a typical Jenkins pipeline might include.

It includes build, test, and then deployment.

84.  Polling a Git repository for new commits is considered a Jenkins antipattern. What is a sound alternative to SVN polling? 

Instead of having a Jenkins poll source code repository, install a post-commit hook on your source code repository and your git server or your GitHub installation. If any time a commit happens to a branch that you are interested in building that particular commit after it’s done, it then triggers the Jenkins build by invoking the build URL and triggering the bill that way. 

85.  Justify the employment of pipeline in Jenkins.

Pipelines in Jenkins help to grasp the stages or tasks that must be performed in keeping with their sequence. It helps the team to handle the task by reviewing, writing material, and iterating. 

86. Have you ever run a machine driven test on Jenkins? How is it done?

Yes, you will be able to run machine-driven tests on Jenkins simply. Tools like element or star will run machine-driven tests. Developers are in a position to look at results and reports via Jenkins display. 

87.  What does CHOMD command do? 

It allows you to change the permission of a file in Linux, it can be changed from read, write, and executable mode. 

88.  Can Jenkins be used for deployment?

Yes, it is used with script, plugins in Jenkins deploy code on the environment using build or publish or SSH. 

89.  Make a case for the various ways to assemble Jenkins node agents to speak with Jenkins master.

Their square measures 2 ways to assemble the Jenkins node agent to speak with the Jenkins master.

Browser:

A JNLP file is downloaded if the Jenkins agent is launched via browser. 

Command line:

A workable agent.jar file is required from the client aspect to begin node agent command-line instruction. 

90.  Make a case for DevOps and during which stage will Jenkins match in? 

DevOps is a combo of software system development and IT operations. For automation of the build, testing, and readying method, Jenkins plays a crucial role. 

91. How does one perform continuous integration mistreatment, Jenkins?

  • Shared Git repository stores the modified source code text file that is committed by the developers. 
  • The shared Git repository is checked at regular intervals by the Jenkins server;detected changes are then taken into the build. 
  • Respective developers get the build result and check results.
  • The machine-driven checks are run, and also the engineered applications are displayed on a test server similar to selenium. 

92. Make a case for Line in JENKINS. 

The line plugin/Job line consists of 2 components:

  • DSL(Domain Specific Language) that with the assistance of Groovy based language permits the user to explain jobs. 
  • Jenkins plugin that helps in the change of the Jenkins that is created and maintained as result and additionally manages the scripts.

93. Make a case for the Multibranch Pipeline in Jenkins.

You can assign different Jenkinsfiles for various branches of the ongoing project in a very multibranch pipeline project kind. Jenkins mechanically discovers, manages, and executes the pipeline for branches that additionally includes Jenkinsfile in supply management. 

94. List out the categories of jobs  in Jenkins. 

  • Freestyle project
  • Maven project 
  • Pipeline
  • Multibranch Pipeline
  • External job
  • Multi configuration project 
  • Github organization 

95.  How will you be able to outline the endless delivery workflow?

The following steps describe the continuous delivery workflow

  • Git Clone
  • Compile
  • Unit Check 
  • Packaging 
  • Deploy

96. What does one mean pipeline as code?

Pipelines in Jenkins job processes with code commit, hold on and versions that are held in the repository.

This option helps in eliminating manual job creation and management and additionally enables Jenkin to get, manage and run jobs for multiple supply repositories. 

97. What is the difference between ANT and Maven?

Maven came after ANT and offers much more than a build tool. The difference between maven ant is in ANT you need to define everything that is source directory, build directory, target directory, etc. while Maven adopts the principle of convention over configuration. 

98. What are Maven components and phases?

Maven comes with three life cycles-default, clean and site 

Default 21(validate, compile, package, install, deploy)

Clean 3(pre-clean,clean,post-clean) 

Site 4(pre-site,site,post-site,site-deploy)

99. How do you automate Kubernetes deployment?

100.  How do you implement unit testing in  Devops ? 

Use unit testing framework 

  • Execute your code with predefined input 
  • Match actual response with expected response 

Implement using Lambda in the pipeline. 

Listed above are the top Jenkins interview questions and answers. These interview questions and answers will boost your core interview skills. I hope these Jenkins interview questions help you crack your interview. 

Recommended Articles