Top 25 Jenkins Interview Questions & Answers

1. What is Jenkins?

Jenkins is an open-source Continuous Integration (CI) server, which automates the build and deploy process of your web applications. 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.

2. What are the different ways Jenkins can authenticate users?

Jenkins authenticates users via:

– An internal database with user data and credentials. (The default.)

– By using the Lightweight Directory Access Protocol server.

– By using the authentication mechanism used by the application server, the Jenkins code is deployed on.

3. Name some of the SCM tools that are supported by Jenkins.

Some of the important SCM tools that are supported by Jenkins include:

– Git

– Subversion

– CVS

– Mercurial

4. Which commands can be used to start Jenkins manually?

You can use any one of the following commands to start Jenkins manually:

– (Jenkins_url)/restart: Forces a restart without waiting for builds to complete.

– (Jenkin_url)/safeRestart: Allows all running builds to complete

5. Name a few Jenkins environment variables.

By default, there are numerous variables available in Jenkins. Some of them are:

– $NODE_NAME

– $JOB_NAME

– $WORKSPACE

– $JOB_URL

– $BUILD_URL

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

To deploy a custom build of a core plugin, you have to do the following:

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

7. What is the use of JENKINS HOME directory?

JENKINS_HOME directory is used to store all the settings, configurations, and logs.

8. Explain how to create a backup and copy files in Jenkins?

Jenkins saves all the build logs and configurations in the home directory. It includes all the slave node configurations and job configurations. For performing back of Jenkins, you should back up the JENKINS_HOME directory frequently. For copying Jenkins jobs, you should replicate the job directory.

9. What are declarative pipelines?

Ans. A declarative pipeline is a new feature in Jenkins that maintains the pipeline as a code and makes it easier to write and read. It is defined within a block labelled pipeline.

Syntax:

pipeline {
/* Declarative Pipeline */
}

10. How will you secure Jenkins?

The way I secure Jenkins is mentioned below if you have any other way to do it than mention that:

– Make sure that the global security is on.

– Check if Jenkins is integrated with my company’s user directory with an appropriate plugin.

– Ensure that the matrix/Project matrix is enabled to fine-tune access.

– Automate the process of setting rights/privileges in Jenkins with custom version controlled script.

– Limit physical access to Jenkins data/folders.

– Periodically run security audits on the same.

11. What do you mean by Pipeline as a Code?

Pipeline as Code describes a set of features that allow Jenkins users to define pipelined job processes with code, stored and versioned in a source repository. These features allow Jenkins to discover, manage, and run jobs for multiple source repositories and branches — eliminating the need for manual job creation and management.

To use Pipeline as Code, projects must contain a file named Jenkinsfile in the repository root, which contains a “Pipeline script.”

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

There are 2 ways to start the node agent –

– Browser: if Jenkins node agent is launched from a browser, a JNLP (Java Web Start) file is downloaded. This file launches a new process on the client machine to run jobs.

– Command-line: to start the node agent using the command line, the client needs the executable agent.jar file. When this file is run, it simply launches a process on the client to communicate with the Jenkins master to run build jobs.

13. What is the difference between Jenkins and Bamboo?

– Open Source: Jenkins is open source but Bamboo is not open source

– Operating System: Jenkins supports Windows, Ubuntu, Red Hat and Mac OS but Bamboo only supports Windows, Linux and Solaris

– Plugin Support: Bamboo does not support many plugin when compared to Jenkins

– Cloud Support: Jenkins offers cloud support while Bamboo does not.

14. What are the advantages of Jenkins?

Advantage of Jenkins includes:

– Bugs tracking are easy at early stage in development environment.

– Provides a large numbers of plugin support.

– Iterative improvement to the code.

– Build failures are cached at integration stage.

– For each code commit changes an automatic build report notification generates.

– To notify developers about build report success or failure, it is integrated with LDAP mail server.

– Achieves continuous integration agile development and test driven development.

– With simple steps, maven release project is automated.

15. How do you copy or move your Jenkins jobs from one server to another?

First, we need to copy our jobs directory from the old to the new server. There are multiple ways to do it. We can either move the job from the installation by simply copying the corresponding job directory or we can make a clone of the job directory by making an existing job’s copy. For this, we need to have a different name, which we can rename later.

16. How to turn off Jenkins Security if the administrative users have locked out of the admin console?

The JENKINS_HOME folder contains a file named config.xml. When security is enabled, this file contains an XML element named useSecurity that will be set to true. By changing this setting to false, security will be disabled the next time Jenkins is restarted.

<useSecurity>false</useSecurity>

 

17. What are the Parameters in Jenkins?

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

18. What is Distributed Builds Architecture in Jenkins?

Jenkins master has its own executors and resources, which can be operated on their own and can execute and manage the build environment. However, with this ‘standalone’ configuration, one can run out of resources as soon as the total number of projects increases. Thus, it is not a good option to run build on central machines. Hence, in such situations, the concept of distributed build architecture comes into the picture. Through this, the users need to configure the Jenkins machines to be the slave machines so that they can easily handle the load of the master Jenkins server.

Here, the slave is a computer on which the unload build projects set up is done to distribute the build task. In this method, either one can stick to a specific machine for a particular build, or they might choose to roam between multiple slaves. It is also termed as master and slave machines.

19. What is AWS Secrets Manager?

It is a precise solution for securing secret storage. In AWS Secrets Manager, one can define any secret for the AWS account just for once, and later, they can give permissions to the users for using this secret. It integrates with other AWS services like:

– Secret entry management

– Secret value management

– Access control

– Secret encryption

– Auditing

20. Define the significance of running Selenium tests in Jenkins.

Below are some of the benefits of running the Selenium test in Jenkins:

– Whenever software is updated, it allows you to run tests and deploy it to a new environment when it passes the test

– With Jenkins, test scheduling is possible

– It will enable you to save all the execution history and test reports

– Maven is integrating with Jenkins, which helps in building and testing project with continuous integration

21. Which is the native scripting language used in Jenkins?

Groovy from Apache, which is a Java-based language, is used as the native scripting language in Jenkins. It improves the performance of Jenkins, and its excellent interface is dynamic and compatible.

22. What do you mean by Jenkins pipeline?

Several interlinked jobs places in a particular sequence are termed as a Jenkins pipeline. It includes several plug-ins that integrate and implement the delivery. There are three different types of Jenkins pipelines:

– CI (Continuous Integration)/CD (Continuous Delivery) pipeline

– Scripted pipeline

– Declarative pipeline

23. What is CRON?

CRON is a syntax used to schedule a Build job or SVN polling in Jenkins. It is exhibited by five asterisks separated by a space. The syntax is written in the format – Minute Hour Dom Month Dow.

Ex: * */1 * * * 

It means that the CRON syntax will execute the job every minute

24. What do you mean by control flow?

Under this, all the scripted pipelines are executed orderly from top to bottom in Jenkins. It is quite similar to the traditional scripts used in Groovy and other different languages.

25. How do I start Jenkins service in Windows?

After downloading the Jenkins installation file for Windows, go to your CMD Terminal and run the following command:

jenkins.exe start

 

Please follow and like us:
Share

Bijan Patel

Founder & Creator of QAScript | 12+ years of IT Experience | Full Stack Automation Engineer | Blogger | Trainer

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!