Interview Questions.

Jenkins Interview Questions

fluid

Jenkins Interview Questions

The tag line of Jenkins, “Build first rate matters at any scale” aptly describes what Jenkins does. You would possibly have read in lots of blogs and articles about how Jenkins allows in non-stop integration thereby assisting developers and testers paintings in tandem to create a robust software program. But what's non-stop integration?

A Quick Overview

In a traditional software lifestyles cycle, builders first develop an entire module and it is going for testing after sanity exams. The testers are loose all through the development cycle but ultimately get overloaded if a whole lot of troubles are observed in a while. This leads to chaos, last-minute changes, and breaking of fine practices. With non-stop integration, builders dedicate a couple of codes changes each day. It is then viable for testers to test and detect problems in the software early on.

Jenkins is one such first rate non-stop integration device written in Java, that lets in builders to integrate their changes into the project. Jenkins looks after the rest of the system of construct, deployment, checking out, and analysis by using automating it. The whole software program improvement cycle now turns into a faster and smoother system.

How does Jenkins do it?

A easy answer – plugins! There are hundreds of plugins available. If you don’t discover the one you want, you may code it your self and share it with the community for greater benefit. The Jenkins network is excellent with hundreds of guide and tools. Some cool functions of Jenkins are –

An extensible automation server, that allows with non-stop integration and continuous delivery

Open supply – super for every body to begin practicing with their own setup

Easy to install, installation and configure

Use it with lots of plugins to beautify the usability of software programs

Can be used across structures as it's far coded in Java

Top Jenkins Interview Questions and Answers

When it involves interview questions, the interviewer will probably begin through asking simple questions like “what's Jenkins”, “What are the functions of Jenkins”, blessings, a bit about set up and so on. However, as he is aware your level of expertise, he's going to probable growth the issue stage of the questions. Be crisp in your solutions.

Whether you are new to Jenkins or an skilled programmer with some palms-on, our comprehensive list of questions will help you crack any Jenkins interview. Starting from the simple degree, the problem of questions will step by step boom as we cross on to the remaining question.

Question: What is Jenkins and why is it used?

Answer: Jenkins is a non-stop integration (CI) tool for real-time trying out and reporting of smaller builds in a massive chunk of code. It is written in Java. It is used as it facilitates developers and testers paintings in tandem to hit upon and close defects early inside the software program development lifecycle and inspire automated trying out of builds.

Question: List a few functions of Jenkins.

Answer: Features of Jenkins are –

Free and open source

Excellent community and documentation

Exhaustive set of plugins and integrations

Easy to installation, install and use on any platform due to the fact it's far primarily based on Java

Supports dispensed builds because of master-slave structure, accordingly lowering the burden at the CI server

Question: What are the benefits of the usage of Jenkins?

Answer: Advantages of Jenkins are –

Provides excellent collaboration between improvement and operations group, making it right into a single DevOps team

Code mistakes can be detected as early as feasible.

Code deployment is straightforward and happens in mins, together with the era of reports.

Automation of integration work, thereby lowering the wide variety of integration issues.

Question: How did Jenkins come into lifestyles?

Answer: Originally known as Hudson, Jenkins came into lifestyles while Oracle took over the ownership to preserve development of the product, by renaming it as Jenkins.

Question: How is non-stop integration achieved the use of Jenkins?

Answer: Here are the stairs –

All the builders commit their source code modifications 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 construct consequences and test consequences are shared to the developers

The built application is displayed on a test server like Selenium and automated checks are ran.

The easy and tested build is deployed to the production server.

Here is a diagram that without a doubt represents these steps –

Question: Do you realize every other non-stop integration equipment? How is Jenkins higher than any of those?

Answer: There are many different CI equipment, the outstanding ones being –

TeamCity

Bamboo

Perforce

Circle CI

Go

ThoughtWorks

Integrity

Travis CI

There are many greater. We can't say if Jenkins is higher than each due to the fact every have their own particular features. For instance, TeamCity gives notable .NET help however is complicated and steeply-priced, Travis CI is unfastened similar to Jenkins and has correct documentation too. Bamboo offers green and quicker builds however isn't absolutely loose and so on.

Question: What is DevOps and wherein stage does Jenkins healthy in?

Answer: DevOps is a software development exercise which blends software improvement (Dev) with the IT operations (Ops) making the complete improvement lifecycle easier and shorter by constantly delivering builds, fixes, updates, and capabilities. Jenkins performs a exquisite position because it enables in this integration through automating the build, check and deployment method.

Question: What are the gadget requirements to put in Jenkins?

Answer: The minimum configuration required is –

256MB of RAM

1 GB of drive area

Java

Web browser

Question: How do you put in Jenkins?

Answer: To install Jenkins, make certain the subsequent are mounted –

Java (version eight)

Apache Tomcat (version 9)

Download the Jenkins struggle file and installation it using Tomcat. You can pick out to put in the plugins advised by using Jenkins for the duration of the set up itself. Once the set up is done, you'll be able to see the Jenkins dashboard.

Question: Give some vital plugins in Jenkins.

Answer: Here you pass –

Maven 2

Gits

Amazon EC2

Join

Copy artifact

Green Balls

HTML Publisher

Question: What is Groovy?

Answer: Groovy from Apache is a language for Java platform. It is the native scripting language for Jenkins. Groovy-based plugins decorate Jenkins with remarkable interfaces and build reviews that are dynamic and regular.

Question: Give a simple use case/scenario to explain how Jenkins works.

Answer:

Let us say a developer is running on a few code adjustments and finally commits them to the repository.

Jenkins server, which continuously checks for adjustments in the repository, detects the change and pulls the adjustments to trigger a build.

The build can fail, wherein case the developer is knowledgeable with reports.

If the construct passes, it is deployed on to the take a look at server.

Once the checking out is entire, a test document is generated and sent to the builders. This process continues till all of the checks are a hit, and then code is deployed to manufacturing.

Question: Can you begin Jenkins the usage of command line? How?

Answer: Yes, the use of jenkins.Exe begin

Question: What are the SCM tools that Jenkins helps?

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

Question: What is a process in Jenkins?

Answer: A activity or build process is a task or step within the complete construct manner. It will be compiling the source code, running unit exams, deploying the utility to the internet server and so forth.

Question: How can you create a task?

Answer: On the dashboard web page, you may just select a ‘New Job’. When you create a job, you can pick alternatives together with the SCM, triggers to manipulate, the build script and notifications.

Question: What is meant by using Jenkins pipeline?

Answer: A pipeline is a set of interlinked jobs finished one after the alternative in a series. To combine and put into effect continuous transport pipelines, Jenkins pipelines presents a mixture of plugins. The commands to be finished are given via code. A non-stop shipping pipeline may be represented as –

Question: What are the varieties of pipelines in Jenkins?

Answer: There are 3 kinds –

CI CD pipeline (Continuous Integration Continuous Delivery)

Scripted pipeline

Declarative pipeline

Question: What syntax does Jenkins use to schedule construct activity or SVN polling?

Answer: The cron syntax.

Cron syntax is represented the usage of 5 asterisks each separated by using a space. The syntax is as follows – [minutes] [hours] [day of the month] [month] [day of the week]. Example, in case you need to set up a cron for each Monday at eleven.Fifty nine pm, it'd be

fifty nine 11 * * 1

Question: Have you created a construct process in Jenkins? Explain a way to do it.

Answer: Yes. The simple steps are –

Click on New Item on the Dashboard.

Select the freestyle venture option

Specify the info of the job like SCM, build triggers, advanced options and so on…

It is vital to specify the place of files that should be built.

Once all the settings are marked, click on on ‘Add build step’ and pick the perfect alternative. For example, in case you want to construct a document, pick the document call together with the construct command.

Click on Build now for saving the build and doing a take a look at run.

Question: How does Jenkins authenticate users?

Answer: There are 3 methods –

The default manner is to store person statistics and credentials in an internal database.

Configure Jenkins to apply the authentication mechanism described by way of the software server on which it's far deployed.

Configure Jenkins to authenticate in opposition to LDAP server.

Question: How can you use a 3rd-party device in Jenkins?

Answer: Let us say we need to use the 0.33-birthday party tool Node.

First make sure Node is set up.

Though the Jenkins admin console, installation the Jenkins plugin for node.

Go to manage within the admin console and configure the settings at the Tools tab.

You can add any configured nodeJS device for your build activity in a pipeline

For exceptional third-birthday party equipment, the system may vary slightly, due to the difference in configuration settings.

Question: Explain the Difference among Jenkins and Bamboo?

Answer:

Jenkins Bamboo
Open-source tool. Commercial tool.
Supported by a huge global community. Has its own dedicated development team.
Less user-friendly compared to Bamboo. More user-friendly features.
Has many plugins to perform various functions. Most features are built-in, and plugins are also available on the Atlassian marketplace.

Question: What is the system of Jenkins?

Answer: Jenkins automates the complete non-stop deployment and shipping process via plugins. The method is as follows:

Developers commit various supply code adjustments to the Git repository.

The Jenkins server maintains checking for repository adjustments and for each check-in, a build is finished.

Jenkins then deploys the constructed application to the check server (like Selenium). The test results are sent again as a feedback.

Once all the assessments are accomplished on the test server, the code is built on the production server.

The feedback is again despatched to the developer thru the diverse levels (test server, Jenkins server, Git repo).

Process of Jenkins

Question: What are the diverse advantages of Jenkins?

Answer: There are many blessings of Jenkins:

Free and open-supply device with extensive network guide.

Easy to put in and configure.

Portable to all the fundamental systems as it's miles built on Java.

Has many plugins for special obligations. If any plugin isn't always there, then builders can code it and contribute the same to the community.

Highly customizable.

Enables excessive-pace software development.

Question: Describe the system to create a backup and replica documents in Jenkins?

Answer: To create a backup, you have to periodically again up your JENKINS_HOME directory.

This listing includes all the construct jobs configurations, slave node configurations, and construct records.

To create a backup, replica this listing, or you can also copy a activity listing to copy any activity or rename the listing.

Question: Explain DSL Jenkins?

Answer: Jenkins DSL (Domain Specific Language) is a plugin thru which jobs can be defined in a programmatic manner that's human readable. Through this plugin, the UI configurations are intuitively translated into code. That manner, you can create a model for the process and additionally hold the records of the adjustments. The converted code is in a Groovy-based totally language. Example,

if you have a parameter definition as below inside the config.Xml file:

<hudson.model.StringParameterDefinition>
 <name>MESSAGE</name>
 <defaultValue>Welcome to Hackr.io</defaultValue>
</hudson.model.StringParameterDefinition>
The corresponding code will look like:
parameters {
 stringParam('MESSAGE', 'Welcome to Hackr.io')
}

Question: Explain the system of making the Multibranch Pipeline in Jenkins?

Answer: The process is as follows:

Open the Jenkins dashboard and create a brand new object by clicking on ‘new object’ from the pinnacle left menu.

Enter your project name and from the alternatives shown, pick out ‘Multibranch pipeline’ and click on OK.

Then you need to select the repository place, branch source (GitHub/Bitbucket), and add the credentials of the branch supply.

Save the undertaking.

Jenkins automatically creates new Multibranch Pipelines for repositories which have branches and pulls requests containing Jenkins files.

To hook up with the GitHub repo, we want the HookURL. Get this URL from the repository settings.

Add this HookURL to the Webhooks phase.

Once the roles are created, build is robotically caused via Jenkins.

Question: Explain the blue ocean in Jenkins.

Answer: Blue ocean is a present day UI for Jenkins, which helps in a customised experience with modern-day design. Through this interface, any consumer can create, diagnose and visualize Continuous Delivery pipelines. It doesn’t want technical competencies to create or understand the pipelines as the whole lot is visually supplied. Also, detection of automation issues is simple as each step can be effortlessly navigated.

Question: Describe Continuous trying out.

Answer: In non-stop trying out, feedback is received at every degree of the continuous shipping pipeline. It helps to enhance code fine through going for walks the automated take a look at cases over and once more. It also reduces the code and checking out cycles, ensuring solid builds are to be had in much less time, as a result optimizing the trying out system.

Question: Explain the manner to combine Git with Jenkins?

Answer: Here are the steps to combine Git with Jenkins:

Create a new Jenkins job and open the Jenkins dashboard.

Enter the assignment call (within the object name) and pick the activity type. Click on OK.

Enter the undertaking data. Go to the ‘Source Code Management’ tab. If the Git plugin is already established in Jenkins, you may see the option ‘Git’.

If you can not see it, you then need to reinstall the plugins – GitHub plugin, GitHub Branch Source plugin, GitHub API plugin, Gitclient plugin and so forth.

After installing the plugins, restart Jenkins to mirror the adjustments.

To pull the code from GitHub, input the repository URL. If you do not have Git set up in your gadget, installation it. To test if Git is installed, type Git in cmd (command set off) and also you ought to see various options like usage, model, help etc.

Question: Create a workflow for Continuous Delivery Workflow.

Answer: To create a CD workflow, we should first create a department. All the coding, testing and code changes are completed in the department. The department modifications are then merged and introduced once the trying out is entire.

Workflow for Continuous Delivery Workflow

Question: Explain the distinction between Continuous Integration, Continuous Delivery, and Continuous Deployment?

Answer: Continuous integration: It is the method of continuously integrating the changes into the principle software program at some point of all of the ranges of the delivery pipeline, once the modifications are examined on the test surroundings. CI can also be called the work achieved by the Jenkins or Bamboo server.

Continuous transport: It is the delivery of code (shipping) to a particular environment like check, integration or manufacturing through a guide launch.

Continuous deployment: It is the automated release of code into the staging or manufacturing environment, once the testing is accomplished inside the CI degree.

Question: What is Pipeline as a Code in Jenkins? Explain numerous kinds of Pipeline?

Answer: Pipeline-as-a-code is a method or set of capabilities that help you preserve the CI/CD workflow common sense within the supply code repository with none extra configurations for every Jenkins branch. This is applicable for projects that have a record named as Jenkinsfile in the root folder of the repo (containing a pipeline script). The types of pipeline syntax are declarative and syntax.

Declarative: These offer an clean manner for growing pipelines and has a predefined hierarchy to create Jenkins pipelines. You can control all the elements of the Pipeline.

Scripted: It runs on the Jenkins grasp via a light-weight executor and uses few resources for translating the Pipeline into code (instructions).

Question: What is Agent Directive in Jenkins?

Answer: The agent directive directs Jenkins on how and wherein to execute the Pipeline or its subsets. All the pipelines require sellers. The agent reasons a workspace to be allotted that consists of checkout files from supply manipulate and different extra running files required for the Pipeline. It additionally causes the steps required for execution to be completed through Jenkins when an executor is to be had.

Question: Explain the difference among Maven, Ant, and Jenkins?

Answer: Jenkins is a CI tool, whereas Ant and Maven are build equipment. Jenkins offers a trigger for the construct to be done. Maven and Ant can simplest carry out construct operations; however, Jenkins can run unit exams, installation programs mechanically.

Between Ant and Maven, Ant is just a tool and is procedural, whereas Maven is a complete declarative framework and has a lifecycle. Ant scripts can't be reused, however Maven plugins may be reused. Ant is an old tool utilized by legacy systems. Most new applications use Maven.

Question: Explain the method of putting in a Jenkins activity?

Answer: Jenkins handles assignment builds through jobs. To installation a activity, you must observe some steps:

Select a brand new item, and input the name of the process.

Select freestyle task and press OK.

Enter the process description and configure the variety of builds and time for which they must be retained.

Configure the repository (Example Git). Enter the URL and credentials.

Specify the build triggers.

Save the task.

Validate the job by using clicking on ‘Build Now’.

Question: How to cozy Jenkins?

Answer: We can at ease Jenkins and configure global protection thru the following:

Deploy Jenkins.Struggle report to the server and start it.

From the homepage (thru URL), click on on Manage Jenkins.

On this page, click on at the ‘Setup Security’ button.

Check the ‘Enable Security’ checkbox.

It is a great practice to have your own database for protection. Select this selection within the ‘Security Realm’ and test the ‘Allow customers to sign on’ checkbox.

Fill the signup shape. Once the signup is successful, you may log in with the brand new account.

Next, go to Manage Jenkins and ‘Configure Global Security’. Now, uncheck the ‘Allow customers to join up’ checkbox. This manner, no new customers can be created without permission.

Now, you could configure the account authentication. There are  techniques: Matrix-based safety&Project-based venture authorization method. You can pick out the only that is suitable for you.

Save the shape and logout and then login with the brand new account.

Question: What is an agent?

Answer: The agent specifies the execution point for a specific degree inside the pipeline or the complete pipeline itself.

Question: How do you outline parameters in Jenkins?

Answer: A construct can take numerous enter parameters to execute. For instance, when you have more than one check suites, but you want to run only one. You can set a parameter to determine which one must be run. To have parameters in a job, you want to specify the identical at the same time as defining the parameter. The parameter may be a string, report or custom.

Question: What are the approaches to configure Jenkins node agent to talk with Jenkins grasp?

Answer: There are 2 approaches to begin the node agent –

Browser – if Jenkins node agent is launched from a browser, a JNLP (Java Web Start) document is downloaded. This file launches a new technique on the consumer device to run jobs.

Command line – to start the node agent the use of the command line, the client desires the executable agent.Jar report. When this file is administered, it launches a system at the patron to talk with the Jenkins master to run construct jobs.

Question: What is a trigger? Give an example of the way the repository is polled while a new devote is detected.

Answer: Triggers outline while and the way pipelines need to be executed.

When Jenkins is incorporated with an SCM, as an instance, Git, the repository may be polled each time there's a devote.

The Git plugin should be first installed and installation.

After that, you can construct a trigger that specifies when a new build must be began. For example, you may create a task that polls the repository and triggers a build when a change is dedicated.

Question: What is the usage of JENKINS_HOME directory?

Answer: All the settings, logs and configurations are saved in the JENKINS_HOME listing.

Question: What is a backup plugin? Why is it used?

Answer: This is a beneficial plugin that backs up all the critical settings and configurations for use within the destiny. This is particularly beneficial whilst there's a failure in order that we don’t lose the settings.

Question: If your project construct is broken, what should you do?

Answer: There are 2 ways to remedy a broken build –

Open the console and double test if all the documents are taken. If any modifications are missing, place them effectively.

Replicate the problem to your local installation to debug and attach the issue.

Question: Let us say, you have a pipeline. The first process changed into a hit, but the 2nd failed. What have to you do subsequent?

Answer: You can restart the pipeline from the point wherein it failed by using doing ‘restart from stage’.

Question: How do you flow or copy Jenkins from an antique server to a new one?

Answer: All the configurations, settings are stored within the JENKINS_HOME (/var/lib/Jenkins) directory. You should replica the entire home directory to the new server. To do so, you can use the command ‘rsync’.

Question: What is the Git plugin?

Answer: Git plugin is used when you are the usage of Git because the repository.

Question: What is Maven? What is the benefit of integrating maven with Jenkins?

Answer: Maven is a construct control device. Using a easy pom.Xml, you can configure all the dependencies had to build, test and run the code. Maven manages the whole lifecycle of a test mission. Once included with Jenkins, the maven Webdriver will build the assignment and execute all exams efficiently.

Question: Have you run computerized tests on Jenkins? How is it completed?

Answer: Yes. Automated checks may be run thru tools like Selenium or maven. Developers can time table the take a look at runs. Jenkins presentations the take a look at consequences and sends a record to the builders.

Question: What is Kubernetes? How can you integrate Jenkins with Kubernetes?

Answer: Kubernetes is a container orchestration device. With Kubernetes, you will create multiple container instances to attain greater fault tolerance. You can use the Kubernetes install plugin to apply it with Jenkins for continuous deploy.

Question: Do you understand about cloud computing? How can Jenkins in shape into a cloud computing environment? Explain with an instance.

Answer: Let us take the example of AWS cloud carrier. Cloud computing services use the CI/CD model so that it will push their paintings to the clients and continuously acquire comments. Jenkins is used to automating the CI/CD pipelines. For instance, a whole lot of Jenkins plugins are available for many of the AWS services like Amazon EC2 and ECS.

Conclusion

Jenkins is a powerful tool and a occurring one. Before your interview, do strive writing a few easy scripts and recognise approximately the maximum famous plugins that Jenkins helps. For instance, Amazon EC2, Git, Kubernetes, Azure, pipeline, SCM, dashboard view, and so forth… With the above set of questions, you are sure to crack the interview and advantage an amazing know-how of this great smooth and extremely useful CI tool.

If you are attempting to find greater interview questions in your education then right here you can check out the fine path that will help you to prepare for Jenkins Interviews: Jenkins 2 Bootcamp: Fully Automate Builds to Deployment.

If you are looking for paperback interview books, then you may checkout with these brilliant programming questions and solutions e-book: 189 Programming Questions and Solutions.




CFG