Spread the love

JENKINS INTERVIEW QUESTIONS & 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.  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.

3. How can you set up a Jenkins job?

To set up a Jenkins job, you may follow these steps:

·         Select New item from the menu

·         Next, enter a name for the job and select a free-style job

·         Click on OK to create a new job

·         Hence, the next page that appears will allow you to configure your job.

4.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
5. 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.

6. 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

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

 8. What are the features of Jenkins?

Some of the crucial features of Jenkins are the following:

·         It is a free and open-source automation tool

·         Jenkins provides a vast number of plugins

·         It is easy to set up and install on multiple operating systems

·         Provides pipeline support

·         Fast release cycles 

·         Easy upgrades

9. Which commands can be used to begin Jenkins?

Here are the commands used to start Jenkins:

·         Open the command prompt

·         After the command prompt opens, browse to the directory where Jenkins war is present

·         Then run the following command:

D:\>Java -jar Jenkins.war

10. What is a CI/CD pipeline?

CI/CD Pipeline or Continuous Integration/ Continuous Delivery is considered the DevOps approach’s backbone. The pipeline is responsible for building codes, running tests, and deploying new software versions.

11. Name the three different types of pipelines in Jenkins?

The three different types of Jenkins pipelines are:

·         CI/CD pipeline 

·         Scripted pipeline

·         Declarative pipeline

12. What are the requirements for using Jenkins?

To use Jenkins, you require the following:

·         A source code repository that can be accessed, for example, a Git repository.

·         A build script, for example, a Maven script.

13. Name the two components that Jenkins is mostly integrated with.

Jenkins is typically integrated with these two components:

1.   Version Control
systems like Git and SVN (Apache Subversion)

2.   Build tools like Maven 

14. Name some of the useful plugins in Jenkins.

Some of the plugins in Jenkins include:

·         Maven 2 project

·         Amazon EC2

·         Copy artifact

·         Join

·         HTML publisher

·         Green Balls  

15. How can you create a backup and copy files in Jenkins?

·         Jenkins stores all the settings, builds scripts, and logs in the home directory. 

·         Then, if you want to create a backup of this Jenkins set up all you have to do is copy this directory. 

·         The job directory may also be copied to clone a job or rename the directory.

 

16. How can you deploy a custom build of a core plugin?

If you wish to deploy a custom build of a core plugin, you follow the following steps:

·         Stop Jenkins

·         Then copy the custom HPI to $Jenkins_Home/plugins

·         After that, delete the previously expanded plugin directory

·         Next, make an empty file called <plugin>.hpi.pinned

·         Finally, start Jenkins

 

17. What is the difference between Jenkins and Bamboo?
 

Parameters

Jenkins

Bamboo

Open Source

Jenkin is open-source

Bamboo is not open source

Pricing Logic

Jenkin is completely free

It charges for the number of build agents required

Operating System

Windows, Ubuntu, Red Hat, Mac OS

Windows, Linux, Solaris

Browsers

Chrome, Firefox, Internet Explorer

Firefox, Chrome, Safari, Edge

Plugin Support

Yes, It supports a lot of plugins

It does not support many plugins as compared to Jenkins

Support

Being open-source, it has a lot of support from communities

It has less support as compared to Jenkins

 

18. What are the benefits of using Jenkins?

I will suggest you include the following benefits of Jenkins if you can recall any other benefit apart from the below-mentioned points you can include that as well.

  • At the integration stage, you can cache build failures.
  • For each change in the source code, you generate an automatic build report notification.
  • To notify developers about build report success or failure, Jenkins integrates with the LDAP mail server.
  • Achieves continuous integration agile development and test driven development.
  • With simple steps, you can automate the maven release project.
  • Easy tracking of bugs at an early stage in a development environment than production.

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

20. Mention some of the useful plugins in Jenkins

Below I have mentioned some important Plugins:

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

21. What are the two components that you can integrate Jenkins with?

According to me, the integration of Jenkins is possible with the following:

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

22. Which SCM tools Jenkins supports?

Here are some of the Source Code Management tools supported by Jenkins:

      • AccuRev
      • CVS
      • Subversion
      • Git
      • Mercurial
      • Perforce
      • Clearcase
      • RTC
23.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. The condition block includes the following conditions – changed success, always, failure, unstable and aborted

24. What are Parameters in Jenkins?

Parameters are supported by Agent section and they are used to support various use-cases pipelines. Parameters are defined at the top-level of the pipeline or inside an individual stage directive.

25. 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.

26. What is the use of JENKINS HOME directory?

All the settings, logs and configurations are stored in the JENKINS_HOME directory

27.How do you define parameters for a build in Jenkins?

A build can take several input parameters to execute. For example, if you have multiple test suites, but you want to run only one. You can set a parameter so that you are able to decide which one should be run. To have parameters in a job, you need to specify the same while defining the parameter. The parameter can be anything like a string, a file or a custom.

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

Below are the steps used for working with a third-party tool in Jenkins.

  • First install the third-party software
  • Download the plug-in that supports the third-party tool.
  • Configure the third-party tool in the admin console.
  • Then use the required plug-in from the Jenkins build job
  • For different third-party tools, the procedure may vary slightly, because of the difference in configuration settings.
29. Name some more continuous Integration tools other than Jenkins.
 

Some of the top continuous integration tools other than Jenkins are:

TeamCity
Travis CI
Go CD
Bamboo
GitLab CI
CircleCI
Codeship

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

These are the types of jobs/projects in Jenkins –

    • Freestyle project
    • Maven project
    • Pipeline
    • Multibranch pipeline
    • External Job
    • Multi-configuration project
    • Github organization
31. How to take a backup of your Jenkins build jobs?

Within the XML configuration, each Jenkins build is stored. When this folder is copied, the configuration of all the build jobs that are managed by the Jenkins master is backed up. If we can perform a Jenkins Git integration, then it is good. When we copy the contents of the folder, we will see that the build jobs described in the folder will be restored when the Jenkins server is started the next time.

 

32. State some of the advantages of using Jenkins.

Here are some of the most important advantages of Jenkins:

·         We will get an automated build report every time a change is made to the source code.

·         We will be able to achieve continuous integration with agile methodology principles.

·         We can automate the maven release project with a few simple steps.

·         Bugs can be easily tracked at an early development stage.

33. How to schedule builds in Jenkins?

Some steps for scheduling builds in Jenkins are as follows:

    • First, we should have a source code management commit.
    • We have to complete the other builds.
    • Then, we have to schedule it to run at a specified time.
    • We need to then give a manual build request.
34. How to create a slave node in Jenkins?

To create a slave node in Jenkins:

    1. Go to Manage Jenkins, and scroll down to Manage Nodes
    2. Click on New Node
    3. Set the node name, choose the Dumb slave option, and then click on OK
    4. Enter the node slave machine details, and click on Save
 35. Differentiate between Bamboo and Jenkins?
 

no

Bamboo

Jenkins

1

Commercial tool

Open-source tool

2

Dedicated development team

Huge global community

3

Comparatively more user friendly 

Less user-friendly 

4

Many built-in features and plugins are available in the Atlassian marketplace.

Many plugins to perform different functions

36.What is the process to configure Third-party tools in Jenkins?

The process to configure Third-party tools in Jenkins can be seen in four significant steps:

Install the third-party software
Then install a Jenkins plugin supporting the third-party tool
Now, configure the tool from the Manage Jenkins section
Finally, your plugin is ready to be used

37. How to deploy a custom build of a core plugin?

The steps to deploy a custom build of a core plugin are:

First, copy the .hpi file to $JENKINS_HOME/plugins
Then remove the plugin’s development directory
Next, create an empty file called <plugin>.hpi.pinned
Finally, restart Jenkins and use your custom build of a core plugin

38. What are the three security mechanisms Jenkins uses to authenticate users?

The three mechanisms are as follows:

1. Jenkins uses an internal database to store user data and credentials.
2. Jenkins can use a lightweight Directory Access Protocol (LDAP) server to authenticate users.
3. We can configure Jenkins to employ the application server’s authentication mechanism upon which we deploy it.

How do you install Jenkins?

Follow the steps mentioned below to install Jenkins:

Install Java
Install Apache Tomcat Server
Download Jenkins war File
Deploy Jenkins war File

Scroll to Top