Jenkins Q&A

[vc_row][vc_column css_animation=”fadeInLeft”][vc_column_text css=”.vc_custom_1562583807326{background-color: #1e73be !important;}”]

Jenkins Interview Questions & Answers

[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column css_animation=”fadeInLeft” width=”1/2″][vc_tta_accordion color=”peacoc” active_section=”1″][vc_tta_section title=”What is Jenkins?” tab_id=”1562583833641-2b4660bf-7a9b”][vc_column_text]Jenkins is a free open source Continuous Integration tool and automation server to monitor continuous integration and delivery. It is written in Java.

It is known as an automated Continuous Delivery tool that helps to build and test the software system with easy integration of changes to the system. Jenkins follows Groovy Scripting.

Also, it enables developers to continuously check in their code and also analyze the post-build actions. The automation testers can use to run their tests as soon as the new code is added or code is modified.[/vc_column_text][/vc_tta_section][vc_tta_section title=” What are the features of Jenkins?” tab_id=”1562583833654-404cce61-4f01″][vc_column_text]Jenkins comes with the following features:

  1. Free open source.
  2. Easy installation on various operating systems.
  3. Build Pipeline Support.
  4. Workflow Plugin.
  5. Test harness built around JUnit.
  6. Easy upgrades.
  7. Rapid release cycle.
  8. Easy configuration setup.
  9. Extensible with the use of third-party plugins.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are the advantages of Jenkins? Why we use Jenkins?” tab_id=”1562583847067-f582fd08-af2c”][vc_column_text]Jenkins is used to continuously monitor the large code base in real time. It enables developers to find bugs in their code and fix. Email notifications are made to the developers regarding their check-ins as

  • Build failures are cached during the integration stage.
  • Notifies the developers about build report status using LDAP (Lightweight Directory Access Protocol) mail server.
  • Maven release project is automated with simple steps.
  • Easy bug tracking.
  • Automatic changes get updated in the build report with notification.
  • Supports Continuous Integration in agile development and test-driven development.

a post-build action.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Mention some of the important plugins in Jenkins?” tab_id=”1562583848323-104a75c4-8916″][vc_column_text]Plugins in Jenkins includes:

  • Gits
  • Maven 2 Project
  • HTML Publisher
  • Copy Artcraft
  • Join
  • Green Balls
  • Amazon EC2

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is Continuous Integration in Jenkins?” tab_id=”1562583849159-fef5741b-875c”][vc_column_text]Continuous integration is the process of continuously checking-in the developer’s code into a version control system and triggering the build to check and identify bugs in the written code.

This is a very quick process and also gives them a chance to fix the bugs. Jenkins is one such continuous integration tool. 

In software development, multiple developers work on different software modules.

While performing integration testing all the modules are being integrated together. It is considered as the development practice to integrate the code into the source repository

Whenever the programmer/developer makes any change to the current code, then it automatically
gets integrated with the system running on the tester’s machine and makes the testing task easy and speedy for the system testers.

Continuous Integration comprises of:

  • Development and Compilation
  • Database Integration
  • Unit Testing
  • Production Deployment
  • Code Labeling
  • Functional Testing
  • Generating and Analyzing Reports

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the difference between Hudson and Jenkins?” tab_id=”1562583849843-6ab70271-cf6a”][vc_column_text] 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.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is Groovy in Jenkins?” tab_id=”1562583850446-80a319bf-0fcf”][vc_column_text]Groovy is the default scripting language that is being used in development from 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.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Which Command is used to start Jenkins?” tab_id=”1562583851831-bb4ad8c5-37b1″][vc_column_text]You can follow the below mentioned steps to start Jenkins:

  1. Open Command Prompt
  2. From the Command Prompt browse the directory where Jenkins. war resides
  3. Run the command given below:
D:\>Java –jar Jenkins.war

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is Jenkinsfile?” tab_id=”1562583852494-14d2f97b-979b”][vc_column_text]The text file where all the definitions of pipelines are defined is called Jenkinsfile. It is
being checked in the source control repository.[/vc_column_text][/vc_tta_section][vc_tta_section title=” What is the difference between Continuous Integration, Continuous Delivery, and Continuous Deployment?” tab_id=”1562583853198-ad28c1cb-274f”][vc_column_text]The diagrammatic representation given below can elaborate on the differences between
Continuous Integration, Continuous Delivery, and Continuous Deployment more precisely.[/vc_column_text][/vc_tta_section][vc_tta_section title=” What is Jenkins pipeline? What is a CI CD pipeline?” tab_id=”1562583853759-2077a25e-c2c7″][vc_column_text]The pipeline can be defined as the suite of plugins supporting implementation and
integration of continuous delivery pipelines in Jenkins.

Continuous integration or continuous delivery pipeline consists of build, deploy, test, release pipeline. The pipeline feature saves a lot of time and error in maintaining the builds. Basically, a pipeline is a group of build jobs that are chained and integrated in sequence.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are Scripted Pipelines in Jenkins?” tab_id=”1562583854399-3c01eeae-102d”][vc_column_text]Scripted Pipeline follows Groovy Syntax as given below:

Node {

In the above syntax, the node is a part of the Jenkins distributed mode architecture, where there
are two types of node Master which handle all the tasks in the development environment and
the Agent is being used to handle multiple tasks individually.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are Declarative Pipelines in Jenkins?” tab_id=”1562583855071-204ce8c0-35fd”][vc_column_text] Declarative Pipelines are the newest additions to Jenkins that simplify the groovy syntax of Jenkins pipelines (top-level pipeline) with some exceptions, such as:

No semicolon to be used as a statement separator. The top-level pipeline should be enclosed within block viz;

The common syntax is:

pipeline {
/* Declarative Pipeline */

Blocks must contain Sections, Directives, steps or assignments.

pipeline {
                agent any
                stages {
stage(‘Build’) {
                steps {
// Statements…
       stage (‘Test’) {
       steps {
              // Statements…

The above code has 3 major elements

  • Pipeline: The block of script contents.
  • Agent: Defines where the pipeline will start running from.
  • Stage: The pipelines contain several steps enclosed in the block called Stage.

[/vc_column_text][/vc_tta_section][vc_tta_section title=” What is SCM? Which SCM tools are supported in Jenkins?” tab_id=”1562583855607-b45ec675-1ede”][vc_column_text]

  • SCM stands for Source Control Management.
  • SCM module specifies source code location.
  • The entry point to SCM is being specified as jenkins_jobs.scm.
  • The job specified with ‘scm’ attribute accepts multiple numbers of SCM definitions.

The SCM can be defined as:

  name: eloc – scm
        url: ssh://

Jenkins supported SCM tools include:

  • CVS
  • Git
  • Perforce
  • AccuRev
  • Subversion
  • Clearcase
  • RTC
  • Mercurial

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Which CI Tools are used in Jenkin?” tab_id=”1562583856321-83c4e4a8-9b9e”][vc_column_text]Jenkins supported CI tools are:

  1. Jenkins
  2. GitLab CI
  3. Travis CI
  4. CircleCI
  5. Codeship
  6. Go CD
  7. TeamCity
  8. Bamboo

[/vc_column_text][/vc_tta_section][vc_tta_section title=” Which commands can be used to start Jenkins manually?” tab_id=”1562583856950-1ac0de86-3558″][vc_column_text] You can use the following commands to start Jenkins manually:

  1. (Jenkins_url)/restart: To force restart without waiting for build completion.
  2. (Jenkin_url)/safeRestart: Waits until all the build gets completed before restarting.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Which Environmental Directives are used in Jenkins?” tab_id=”1562583857599-53ae081f-448d”][vc_column_text]Environmental Directives is the sequence which specifies pairs of the key-values called
Environmental Variables for the steps in the pipeline.[/vc_column_text][/vc_tta_section][vc_tta_section title=” What are Triggers?” tab_id=”1562583858264-acc12406-2a00″][vc_column_text] Trigger in Jenkins defines the way in which the pipeline should be executed
frequently. PollSCM, Cron, etc are the currently available Triggers.[/vc_column_text][/vc_tta_section][/vc_tta_accordion][/vc_column][vc_column css_animation=”fadeInRight” width=”1/2″][vc_tta_accordion color=”peacoc” active_section=”1″][vc_tta_section title=” What is Agent Directive in Jenkins?” tab_id=”1562583873288-d0c0a1a5-984c”][vc_column_text]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.[/vc_column_text][/vc_tta_section][vc_tta_section title=” How to make sure that your project build does not break in Jenkins?” tab_id=”1562583873307-9da0057e-6b29″][vc_column_text] You need to follow the below-mentioned steps to make sure that the Project build does not break:

  1. Clean and successful installation of Jenkins on your local machine with all unit tests.
  2. All code changes are reflected successfully.
  3. Checking for repository synchronization to make sure that all the differences and changes related to config and other settings are saved in the repository.

[/vc_column_text][/vc_tta_section][vc_tta_section title=” What is the difference between Maven, Ant, and Jenkins?” tab_id=”1562583886397-acf79dc2-867b”][vc_column_text]Maven vs Jenkins:

Maven is a build tool like Ant. It consists of a pom.xml file which is specified in Jenkins to run the code. Whereas, Jenkins is used as a continuous integration tool and automate the deployment process. The reports of the builds can be used to set a mark for continuous delivery as well.

We will review the differences between Maven, Ant, and Jenkins in a comparative way:

Maven Ant Jenkins
It is a Build Automation Tool. Java Library/Command Line Tool. Continuous Integration Tool.
Defines how the software is built and describes the software dependencies. Drives build process. Automates the software development process with Continuous Integration and facilitates Continuous Deliver.
Supports projects written in C#, Ruby. Supports projects written in C and C++. Supports version control tools like Git, AccuRev.
Executes Unit Tests as a part of the normal build cycle. Supports single file execution introduced with Java II. Can execute Apache Ant and Apache Maven.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”How will you define Post in Jenkins?” tab_id=”1562583886929-6aa4e831-3fdd”][vc_column_text]Post is a section that contains several additional steps which 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.

The condition block includes the following conditions – changed success, always, failure, unstable and aborted.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are Parameters in Jenkins?” tab_id=”1562583887560-54c76c9f-4924″][vc_column_text]Parameters are supported by 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.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are the two components (pre-requisites) that Jenkins is mainly integrated with?” tab_id=”1562583888070-ec0f0421-800f”][vc_column_text] Jenkins integrates with:

  1. Build tools/ Build working script like Maven script.
  2. Version control system/Accessible source code repository like Git repository.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”How can You Clone a Git Repository via Jenkins?” tab_id=”1562583888671-df093558-e675″][vc_column_text]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 configcommand.[/vc_column_text][/vc_tta_section][vc_tta_section title=”How can you secure Jenkins?” tab_id=”1562583889243-bd21a90d-191f”][vc_column_text]Securing Jenkins is a little lengthy process, and there are two aspects of securing Jenkins:

(i) 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.

(ii) Protecting Jenkins users from outside threats.[/vc_column_text][/vc_tta_section][vc_tta_section title=”How to create a backup and copy files in Jenkins?” tab_id=”1562583889783-d8f91b52-da29″][vc_column_text]In Jenkins, all the settings, build logs and configurations are stored in the JENKINS_HOME
directory. Whenever you want to create a backup of your Jenkins you can back up JENKINS_HOMEdirectory frequently.

It consists of all the job configurations and slave node configurations. Hence, regularly copying this directory allows us to keep a backup of Jenkins.

You can maintain a separate backfile and copy it whenever you need the same. If you want to copy the Jenkins job, then you can do so by simply replicating the job directory.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the use of Backup Plugin in Jenkins? How to use it?” tab_id=”1562583891063-de567494-db27″][vc_column_text]Jenkins Backup Plugin is used to back up the critical configurations and settings in order to use them in the future in case of any failure or as per the need of time.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is Flow Control in Jenkins?” tab_id=”1562583891615-9054bc03-5de4″][vc_column_text]In Jenkins, flow control follows the pipeline structure (scripted pipeline) that are being
executed from the top to bottom of the Jenkins file.[/vc_column_text][/vc_tta_section][vc_tta_section title=” What is the solution if you find a broken build for your project?” tab_id=”1562583892092-79d31fe2-83d5″][vc_column_text]To resolve the broken build follow the below-mentioned steps:

(i) Open console output for the build and check if any file change has missed.


(ii) 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)

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are the basic requirements for installing Jenkins?” tab_id=”1562583892639-72a9552a-bed2″][vc_column_text] For installing Jenkins you need the following system configuration:

  1. Java 7 or above.
  2. Servlet 3.1
  3. RAM ranging from 200 MB to 70+ GB depending on the project build needs.
  4. 2 MB or more of memory.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”How can you define a Continuous Delivery Workflow?” tab_id=”1562583893272-8cae906e-a8f6″][vc_column_text]The flowchart below shows the Continuous Delivery Workflow. Hope it will be much easier to understand with visuals.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are the various ways in which the build can be scheduled in Jenkins?” tab_id=”1562583894588-f9d46762-4ac1″][vc_column_text] The build can be triggered in the following ways:

  1. After the completion of other builds.
  2. By source code management (modifications) commit.
  3. At a specific time.
  4. By requesting manual builds.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Why is Jenkins called a Continuous Delivery Tool?” tab_id=”1562583895111-1556fbba-28b7″][vc_column_text]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:

  1. Developers work on their local environment for making changes in the source code and push it into the code repository.
  2. When a change is detected, Jenkins performs several tests and code standards to check whether the changes are good to deploy or not.
  3. Upon a successful build, it is being viewed by the developers.
  4. Then the change is deployed manually on a staging environment where the client can have a look at it.
  5. 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.
[/vc_column_text][/vc_tta_section][vc_tta_section title=”Give any simple example of Jenkins script.” tab_id=”1562583895903-f5ca6cee-210b”][vc_column_text]This is a Jenkins declarative pipeline code for Java:

pipeline {
    stages {
          stage('Building your first asset') {
               steps {
                   echo 'Build asset'
        stage('Test') {
             steps {
                   echo 'Building project 1'

These are some of the frequently asked questions in the Jenkins interview, you can practice them as part of your preparation for the interview.

We advise you to practice some Jenkins scripts before attending an interview. Also for detailed information and processes in Jenkins please check Jenkins.[/vc_column_text][/vc_tta_section][/vc_tta_accordion][/vc_column][/vc_row]

WhatsApp us