Slide 1
Most trusted JOB oriented professional program
DevOps Certified Professional (DCP)

Take your first step into the world of DevOps with this course, which will help you to learn about the methodologies and tools used to develop, deploy, and operate high-quality software.

Slide 2
DevOps to DevSecOps – Learn the evolution
DevSecOps Certified Professional (DSOCP)

Learn to automate security into a fast-paced DevOps environment using various open-source tools and scripts.

Slide 2
Get certified in the new tech skill to rule the industry
Site Reliability Engineering (SRE) Certified Professional

A method of measuring and achieving reliability through engineering and operations work – developed by Google to manage services.

Slide 2
Master the art of DevOps
Master in DevOps Engineering (MDE)

Get enrolled for the most advanced and only course in the WORLD which can make you an expert and proficient Architect in DevOps, DevSecOps and Site Reliability Engineering (SRE) principles together.

Slide 2
Gain expertise and certified yourself
Azure DevOps Solutions Expert

Learn about the DevOps services available on Azure and how you can use them to make your workflow more efficient.

Slide 3
Learn and get certified
AWS Certified DevOps Professional

Learn about the DevOps services offered by AWS and how you can use them to make your workflow more efficient.

previous arrow
next arrow

Top 50 Jenkins interview questions and answers

Spread the Knowledge
Jenkins interview questions and answers

1. What is Jenkins?

Jenkins is a self-contained, open-source automation server that can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software. Jenkins can be installed through native system packages, Docker, or even run standalone by any machine with a Java Runtime Environment (JRE) installed.

2) Tell me something about Continuous Integration, Continuous Delivery, and Continuous Deployment?

Continuous Integration: A software development process where the changes made to software are integrated into the main code as and when a patch is ready so that the software will be always ready to be – built, tested, deployed, monitored – continuously.

Continuous Delivery: This is a Software Development Process where the continuously integrated (CI) changes will be tested & deployed continuously into a specific environment, generally through a manual release process, after all the quality checks are successful

Continuous Deployment: A Software Development practice where the continuously integrated (CI) changes are deployed automatically into the target environment after all the quality checks are successful

3) What are the common use cases Jenkins is used for?

Jenkins being open-source automation can be used for any kind of software-based automation. Some of the common use-cases include but not limited to –

  • Software build jobs
  • Sanity/Smoke/CI/Regression test jobs
  • Web/Data Scraping related jobs
  • Code coverage measurement jobs
  • General-purpose automation
  • Reverse Engineering jobs
  • Key Decoding jobs & many other jobs where software automation will be applicable.

4) What are the ways to install Jenkins?

Jenkins can be installed using –

  • Native System Package Manager like – apt (Linux), brew (Mac), etc.
  • Docker (popular docker images for Jenkins is available for different platforms like Unix/Mac/Windows in the docker registry)
  • Kubernetes (available as a helm chart and can be installed on our Kubernetes clusters)
  • Standalone (on any machine with a Java Runtime Environment installed)

5) What is a Jenkins job?

A Job/Project is the fundamental unit of a logical work (like a software build, an automation task, test execution, etc) using the Jenkins automation server and other required plugins, configurations & infrastructures.

Jobs can be of different types like – a freestyle project, a multi-configuration project, a pipeline project, a multi-branch project, etc.

6. What are the types of Jenkins pipelines?

Jenkins Pipelines can be either – a Declarative pipeline or a Scripted Pipeline. Declarative pipeline makes use of numerous, generic, predefined build steps/stages (i.e. code snippets) to build our job according to our build/automation needs whereas, with Scripted pipelines, the steps/stages can be custom-defined & used using a groovy syntax which provides better control & fine-tuned execution levels.

7) How do you store credentials in Jenkins securely?

Credentials can be stored securely in Jenkins using the Credentials plugin, which stores different types of credentials like – Username with a password, SSH username with the private key, AWS Credentials, Jenkins Build Token, Secret File/Text, X509 & other certificates, Vault related credentials securely with proper encryption & decryption as and when required.

8) How can we stop a scheduled job from being executed temporarily?

Disable the job from the job details page to temporarily stop all scheduled executions & other factors/events from triggering the job and enable it back to resume the job schedules/triggers. If a job is not required permanently, we can delete the job from the jobs list view page.

9) What are the ways to trigger a Jenkins Job/Pipeline?

There are many ways we can trigger a job in Jenkins. Some of the common ways are as below –

  • Trigger an API (POST) request to the target job URL with the required data.
  • Trigger it manually from the Jenkins web application.
  • Trigger it using Jenkins CLI from the master/slave nodes.
  • Time-based Scheduled Triggers like a cron job.
  • Event-based Triggers like SCM Actions (Git Commit, Pull Requests), WebHooks, etc.
  • Upstream/Downstream triggers by other Jenkins jobs.

10) What is Jenkins Build Cause?

Build Cause is a text attribute that represents what made a job’s build to be triggered, say it could be a Jenkins User (from UI), Timer for Scheduled jobs, Upstream jobs for a job which was triggered by upstream job, etc. This is mainly used to identify the nature of the builds – be it nightly, manual, automated, etc.

11) How Jenkins knows when to execute a Scheduled job/pipeline and how it is triggered?

Jenkins master will have the cron entries set up for the jobs as per the scheduled Job’s configurations. As and when the time for a particular job comes, it commands agents (based on the configuration of the job) to execute the job with required configurations.

12) What are the credential types supported by Jenkins?

In Jenkins, credentials are a set of information used for authentication with internal/external services to accomplish an action. Jenkins credentials are provisioned & managed by a built-in plugin called – Credentials Binding – plugin. Jenkins can handle different credentials as follows –

Secret text – A token such as an API token, JSON token, etc.
Username and password – Basic Authentication can be stored as a credential as well.
Secret file – A secret file used to authenticate some secure data services & security handshakes.
SSH Username with a private key – An SSH public/private key pair for Machine to Machine authentication.
Certificate – a PKCS#12 certificate file and an optional password.
Docker Host Certificate Authentication credentials.
And as we can guess, this can be extended to several other extensible credential types like – AWS credential, Azure secrets, etc. using commonly available plugins.

13) What are the Scopes of Jenkins Credentials?

Jenkins credentials can be of one of the two scopes – Global & System

Global – the credential will be usable across all the jobs configured in the Jenkins instance (i.e. for all jobs). This is more suited for user Jobs (i.e. for the freestyle, pipeline, or other jobs) to authenticate itself with target services/infrastructures to accomplish the purpose of the job)

System – This is a special scope that will allow the Jenkins itself (i.e. the core Jenkins functionalities & some installed plugins) to authenticate itself to external services/infrastructures to perform some defined tasks. E.g. sending emails, etc.

14) What is a Jenkins Shared Library and how it is useful?

As an organization starts using more and more pipeline jobs, there is a chance for more and more code being duplicated in every pipeline job, since a part of the build/automation processes will be the same for most of the jobs. In such a situation, every other new upcoming job should also duplicate the same piece of code. To avoid duplications, the Jenkins project brought in the concept of Shared Libraries, to code – DRY – Don’t Repeat Yourself.

Shared libraries are a set of code that can be common for more than one pipeline job and can be maintained separately. Such libraries improve the maintenance, modularity & readability of the pipeline code. And it also speeds up the automation for new jobs.

15) How do you store credentials in Jenkins securely?

Credentials can be stored securely in Jenkins using the Credentials plugin, which stores different types of credentials like – Username with a password, SSH username with the private key, AWS Credentials, Jenkins Build Token, Secret File/Text, X509 & other certificates, Vault related credentials securely with proper encryption & decryption as and when required.

16) What is Jenkins and why is it used?

Jenkins is a continuous integration (CI) tool for real-time testing and reporting of smaller builds in a large chunk of code. It is written in Java. It is used because it helps developers and testers work in tandem to detect and close defects early in the software development lifecycle and encourage automated testing of builds.

17) List some features of Jenkins.

Features of Jenkins are –

  • Free and open source
  • Excellent community and documentation
  • Exhaustive set of plugins and integrations
  • Easy to set up, install and use on any platform because it is based on Java
  • Supports distributed builds due to master-slave architecture, thus reducing the load on the CI server

18) What are the advantages of using Jenkins?

Advantages of Jenkins are –

  • Provides great collaboration between development and operations team, making it into a single DevOps team
  • Code errors can be detected as early as possible.
  • Code deployment is easy and happens in minutes, along with the generation of reports.
  • Automation of integration work, thereby reducing the number of integration issues.

19) 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.

20) 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 ran.
  • The clean and tested build is deployed to the production server.

21) 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 –

TeamCity
Bamboo
Perforce
Circle CI
Go
ThoughtWorks
Integrity
Travis CI
There are many more. We cannot say if Jenkins is better than each because each have their own unique features. For example, TeamCity offers great .NET support but is complex and costly, Travis CI is free just like Jenkins and has good documentation too. Bamboo offers efficient and faster builds but is not completely free and so on.

22) 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.

23) What are the system requirements to install Jenkins?

The minimum configuration required is –

  • 256MB of RAM
  • 1 GB of drive space
  • Java
  • Web browser

24) Give some important plugins in Jenkins.

Here you go –

Maven 2
Gits
Amazon EC2
Join
Copy artifact
Green Balls
HTML Publisher

25) What is Groovy?

Groovy from Apache is a language for Java platform. It is the native scripting language for Jenkins. Groovy-based plugins enhance Jenkins with great interfaces and build reports that are dynamic and consistent.

26) 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 on to 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.

27) Can you start Jenkins using command line? How?

Yes, using jenkins.exe start

28) What are the SCM tools that Jenkins supports?

The SCM or Source Code Management tools Jenkins supports are SVN, Clearcase, CVS, Git, AccuRev, Perforce, RTC, Mercurial.

29) What is a job in Jenkins?

A job or build job is a task or step in the entire build process. It could be compiling the source code, running unit tests, deploying the application to the web server and so on.

30) How can you create a job?

On the dashboard page, you can just select a ‘New Job’. When you create a job, you can choose options such as the SCM, triggers to control, the build script and notifications.

31) What is meant by Jenkins pipeline?

A pipeline is a group of interlinked jobs done one after the other in a sequence. To integrate and implement continuous delivery pipelines, Jenkins pipelines provides a combination of plugins. The instructions to be performed are given through code.

32) What are the types of pipelines in Jenkins?

There are 3 types –

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

33) How do you install Jenkins?

To install Jenkins, make sure the following are installed –

Java (version 8)
Apache Tomcat (version 9)
Download the Jenkins war file and deploy it using Tomcat. You can choose to install the plugins suggested by Jenkins during the installation itself. Once the installation is done, you will be able to see the Jenkins dashboard.

34) Explain what is continuous integration?

In software development, when multiple developers or teams are working on different segments of same web application, we need to perform integration test by integrating all modules. In order to do that an automated process for each piece of code is performed on daily bases so that all your code get tested.

35) What is the requirement for using Jenkins?

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

36) 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.

37) Mention what are the commands you can use to start Jenkins manually?

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

(Jenkins_url)/restart: Forces a restart without waiting for builds to complete
(Jenkin_url)/safeRestart: Allows all running builds to complete

38) Mention some of the useful plugins in Jenkin?

Some of the important plugins in Jenkin includes

  • Maven 2 project
  • Amazon EC2
  • HTML publisher
  • Copy artifact
  • Join
  • Green Balls

39) 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 .hpi.pinned
  • Start Jenkins

40) Explain how can create a backup and copy files in Jenkins?

Jenkins saves all the setting, build artifacts and logs in its home directory, to create a back-up 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.

41) Explain how you can clone a Git repository via Jenkins?

To clone a Git repository via Jenkins, you have to enter the e-mail and user name for your Jenkins system. For that, you have to switch into your job directory and execute the “git config” command.

42) Explain how you can set up Jenkins job?

To create a project that is handled via jobs in Jenkins. Select New item from the menu, once this done enter a name for the job and select free-style job. Then click OK to create new job in Jenkins. The next page enables you to configure your job.

43) 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.

44) Why should we use Jenkins?

Jenkins is often used to consistently design and validate software applications. It makes it easy for developers to implement updates to the code and for users to get the latest version quickly. Jenkins uses plugins to accomplish Continuous Integration. Plugins essentially allow DevOps stages to be integrated.

45) How does Jenkins achieve Continuous Integration?

Continuous Integration is a programming process that requires developers to commit updates to the source code in a public repository many times a day or at frequent intervals. A repository is created for any commitments made. As a result, any challenges can be spotted by the team early on. Moreover, the Continuous Integration platform performs various other tasks, such as deploying the development application to the test server, informing the relevant teams about the construct and test performance, etc. Jenkins uses plugins to accomplish Continuous Integration. Plugins generally allow DevOps stages to be integrated.

46) Explain DevOps and how Jenkins is used in it?

Azure DevOps (formerly known as Visual Studio Team Services – VSTS) is a series of tools for creating, evaluating, and distributing software. Developing and installing software has become even more effective with Azure DevOps. It is not only a series of software for automating CI-CD using the Microsoft stack but it can also be conveniently integrated with a variety of other third-party tools.

47) List the system requirements for the installation of Jenkins.

Jenkins requires a few basic requirements to be installed on your Windows system.

Hardware Prerequisites

Jenkins needs at least 256 MB of RAM on your computer or laptop to run.
Jenkins can take up at least 1 GB of space on your hard disc.
Software Prerequisites

Since Jenkins is based on Java, you’ll need the most recent update of either the Java Development Kit (JDK) or the Java Runtime Environment (JRE).

48) Explain the process of installation of Jenkins

The measures below should be taken to install Jenkins effectively:

  • Go to https://www.jenkins.io/download/ and choose the platform you want to use.
  • Unzip the downloaded package from your local computer’s download spot. Double-click the jenkins.msi file that has been unzipped.
  • Press next on the Jenkins setup pad.
  • Selecting the directory where you want the Jenkins instance to be saved (the default location is C: Program Files (x86)Jenkins).
  • Click on the install option.
  • When the installation is completed, click on finish.

49) Name the Jenkins suite’s essential plugins?

The Jenkin suite’s essential plugins are Docker, Jira, Slack Notification, Maven, Amazon E2C, jUnit, Pipeline, Mailer, and Greenballs.

50) Explain what Groovy means?

Jenkins uses a domain-specific language (DSL) called “Groovy” inside a Pipeline Project (read plugin), which will describe a new pipeline as just a script. That single script may articulate a flow that would typically take several “standard” Jenkins jobs chained around.

Groovy will work in conjunction with Java, and the two languages’ syntaxes are very close. While writing Groovy, when you forget the grammar, you can write in Java syntax. Groovy may be used as one of the Java platform’s scripting languages. Groovy scripts could be named from inside Java, reducing the amount of time spent on Java development.

51) Explain Jenkins’ working in a simple use-case?

Let’s assume a developer is operating on a code and contributes it to the repository.

Jenkins server scans for adjustments in the repository detects the code and pulls it to start a build.
If the build malfunctions, the results are sent to the developer to make changes.
If it succeeds, the build is deployed to a test server.
A test report is produced and submitted to the developer when the testing is completed. This method is repeated until the code passes all the checks, after which it is deployed to output.

52) How does one start using Jenkins from the command line?

The Jenkins Web application ARchive (WAR) file can be started from the command line in the following manner:

  • Download the latest stable Jenkins WAR file to an appropriate directory on your machine.
  • Open up a terminal/command prompt window to the download directory.
  • Run the command java -jar Jenkins.War.
  • Browse to http://localhost:8080 and wait until the unlock Jenkins page appears.
  • Continue with the post-installation setup wizard below.

Related video:

Rajesh Kumar
Latest posts by Rajesh Kumar (see all)
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x