Jenkins, Maven and GIT

1) What is Git? What is the difference between Git and GitHub?

Git is a distributed version-control system for tracking changes in any set of files.

Git is a version control system to manage source code history but GitHub is a hosting service for Git repositories.

2) What is Maven and explain about different Maven goals?

Maven is a build automation tool used primarily for Java projects. Maven addresses two aspects of building software: how software is built and its dependencies.

A plugin goal represents a specific task which contributes to the building and managing of a project. Below are some of the phases and default goals bound to them:

compiler:compile the compile goal from the compiler plugin is bound to the compile phase

compiler:testCompile it is bound to the test-compilephase

surefire:test it is bound to testphase

install:install it is bound to installphase

jar:jar and war:war it is bound to package phase

3) What is the difference between SVN & GIT?

Git is a distributed version control system but SVN is a centralized version control system.

4) How do you maintain source code in GIT?

We maintain source code inside different repositories in GIT.

5) What are the different plugins used for Maven? And it’s use?

Some of the important plugins in Maven are:

– clean: cleans up the target directories after the build is completed

– compiler: compiles the Java Source Code

– deploy: Deploys the built artifact to remote repository

– failsafe: Runs the integration tests

– install: Install the built artifact in the local repository

– surefire: Runs the unit tests

6) What’s the difference between plug-ins and dependencies?

Plugins are core feature of Maven which allow reuse of common build logic across different projects.

Dependencies are different archives which is required to build/compile/run current project.

7) How do you define dependencies in your Maven Project?

While working with a Maven project we need different libraries to run the project. These libraries can be automatically downloaded and managed by Maven dependencies.

8) What is Maven and its advantages of using it in your Selenium Project ?

Maven is a build management tool. Maven is used to define project structure, build and test management.

9) What is the name of maven folder which contains all the libraries?

External Libraries contain all the libraries.

10) Explain the life cycle of Maven?

Lifecycle of maven is the process of building and distributing a particular artifact. There are 3 built in build lifecycles – default, clean and site.

11) Explain different Git commands?

git add – Add file contents to the index

git commit – Record changes to the repository

git pull – Fetch from and integrate with another repository or a local branch

git push – Update remote refs along with associated objects

git init – Create an empty Git repository or reinitialize an existing one

git clone – Clone a repository into a new directory

12) In Maven, from where the jar files will get downloaded from?

In maven jar files are downloaded from the maven central repository.

13) In Maven, do we have to manually download and configure/update the required jar files?

No. Maven automatically downloads and updates the required jar files and dependencies.

14) What are the different phases of Maven?

The default lifecycle comprises of the following phases :

validate – validate the project is correct and all necessary information is available

compile – compile the source code of the project

test – test the compiled source code using a suitable unit testing framework.

package – take the compiled code and package it in its distributable format, such as a JAR.

verify – run any checks on results of integration tests to ensure quality criteria are met

install – install the package into the local repository, for use as a dependency in other projects locally

deploy – done in the build environment, copies the final package to the remote repository for sharing with other developers and projects.

15) What is Jenkins?

Jenkins is an open source Continuous Integration tool. It helps to automate the different stages of software development lifecycle like building, testing and deployment.

16) How do you start Jenkins?

We can start Jenkins by running the following command:

java -jar jenkins.war –httpPort=8080

17) How will you configure Jenkins?

We need to configure the following in Jenkins:

– Source Code Management

– Build Triggers

– Build Environment

– Build

– Post-build Actions

18) What are the basic plugins you used in Jenkins?

Some of the basic plugins in Jenkins are:

– Email Extension

– Git

– JUnit

– Maven Integration

– NodeJS Plugin

– SSH Plugin

– Pipeline

– Browserstack

19) How to create a job in Jenkins?

– Click on New Item in Jenkins dashboard

– Enter an item name

– Select type of project (Ex – Freestyle Project)

– Enter configuration details for the job

– Save the job

20) On what platform JENKINS will work?

Jenkins can run on Windows, Linux, MacOS and other Unix like operating systems.

21) How do you manage reports in Jenkins?

We can manage reports with the help of different reporting plugins like Junit, Cucumber, HTML.

22) How to integrate your test with Jenkins?

We can integrate our test by adding the git repository in the Source Code Management section and then invoking the maven goals in Build section to run the tests.

23) How do you setup Maven Project in Jenkins?

– Click on New Item in Jenkins dashboard

– Enter an item name

– Select type of project as Maven Project

24) Jenkins Tool – Scheduled Batch Run?

We can schedule our builds to run automatically in Jenkins by configuring the Build Triggers.

Ex – Select Build Periodically and enter H/15 * * * * to run the build every 15 minutes.

25) How to run the test scripts in Jenkins?

We can run test scripts in Jenkins in the following ways:

– By invoking Maven Goals in Build section

– By executing shell/batch command

  1. What is Jenkins?

Jenkins is an open-source free automation tool used to build and test software projects. The tool makes it painless for developers to integrate changes to the project. Jenkins’ primary focus is to keep track of the version control system and initiate and monitor a build system if there are any changes. It keeps an eye on the entire process and provides reports and notifications to alert.

Some typical reasons as to why Jenkins is so widely used are:

  • Developers and testers use Jenkins to detect defects in the software development lifecycle and automate the testing of builds.
  • They use it to continuously monitor the code in real-time and integrate changes into the build.
  • Jenkins as it turns out, is a great fit for building a CI/CD pipeline because of its plugin-capabilities, and simple-to-use nature.

****Improve Your Earning Potential Further!DevOps Engineer Masters ProgramEXPLORE PROGRAM

!https://www.simplilearn.com/ice9/banners/free_resources_banners/lead_banners/DevOps_Engineer.png

  1. 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
  1. What is Groovy in Jenkins?
  • Apache Groovy is a dynamic object-oriented programming language used as a scripting language for Java platforms.
  • Groovy is used to orchestrate the Jenkins pipeline and enables different teams to contribute to the work in different languages.
  • Groovy’s syntax is very similar to that of Java, making it more seamless with the Java interface.
  • The language has several features like Java compatibility and Development support.

Also Read: All You Need to Know for Choosing the First Programming Language to Learn

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

****Improve Your Earning Potential Further!DevOps Engineer Masters ProgramEXPLORE PROGRAM

!https://www.simplilearn.com/ice9/banners/free_resources_banners/lead_banners/DevOps_Engineer.png

  1. What is “Continuous Integration” with reference to Jenkins?
  • Continuous Integration is a development practice where the codes can be integrated into a shared repository.
  • The practice uses automated verifications for the early detection of code problems.
  • Continuous Integration triggers the build to find and identify bugs present in the code.
  • It adds consistency to the build process.
  • It’s a means to build things faster and prevents broken code.

!https://www.simplilearn.com/ice9/free_resources_article_thumb/Continuous_Integration.png

  1. What are the differences between Continuous Integration, Continuous Delivery, and Continuous Deployment?

Continuous Integration

Continuous Delivery

Continuous Deployment

Continuous Integration (CI) is a DevOps software development practice that permits developers to combine/merge the changes to their code in the central repository to run automated builds and tests.

Continuous Delivery (CD) refers to the building, testing, and delivering improvements to the software code. The most critical part of the CD is that the code is always in a deployable state.

Continuous Deployment (CD) is the ultimate stage in the DevOps pipeline. It  refers to automatic release of any developer changes from the repository to the production stage.

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

  1. What is a Jenkins pipeline?
  • The pipeline represents the continuous delivery and continuous integration of all the jobs in the SDLC and DevOps life cycle.
  • The Jenkins pipeline is a set of plugins that support implementation and integration of continuous delivery pipelines into Jenkins. It connects this pipeline in a particular format by Jenkins.
  • The Jenkins pipeline solves several problems like the maintenance of thousands of jobs and maintaining deployment with needing to resort to other powerful methods.
  1. Name the three different types of pipelines in Jenkins?

The three different types of Jenkins pipelines are:

  • CI/CD pipeline
  • Scripted pipeline
  • Declarative pipeline

****Improve Your Earning Potential Further!DevOps Engineer Masters ProgramEXPLORE PROGRAM

!https://www.simplilearn.com/ice9/banners/free_resources_banners/lead_banners/DevOps_Engineer.png

  1. 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.
  1. 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.
  1. 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
  1. Name some of the useful plugins in Jenkins.

Some of the plugins in Jenkins include:

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

Intermediate Level Jenkins Interview Questions

****Improve Your Earning Potential Further!DevOps Engineer Masters ProgramEXPLORE PROGRAM

!https://www.simplilearn.com/ice9/banners/free_resources_banners/lead_banners/DevOps_Engineer.png

  1. 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
  1. What could be the steps to move or copy Jenkins from one server to another?

There are multiple ways to move or copy Jenkins from one server to another:

  • You may move a job from one Jenkins installation to another just by copying the corresponding job directory.
  • You may make a copy of an already existing job by making a clone of the job directory with an uncommon name.
  • You may also just rename a current job by renaming a directory.

!https://www.simplilearn.com/ice9/free_resources_article_thumb/OneServer_ToAnother.png

  1. 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
  1. Assume that you have a pipeline. The first job that you performed was successful, but the second one failed. What would you do now?

You don’t have to worry, and you just have to restart the pipeline from the point where it failed by doing ‘restart from stage.’

  1. Explain the process in which Jenkins works?

Here’s the process in which Jenkins works:

  • Jenkins checks changes in repositories regularly, and developers must secure their code regularly.
  • Once the changes are defined, Jenkins detects them and uses them to prepare a new build.
  • After that, Jenkins will transverse through various stages in its usual pipeline. As one stage completes, the process will move further on to the next stage.
  • If a stage fails, the Jenkins build will stop there, and the software will email the team using it. When completed successfully, the code implements itself in the proper server so that testing begins.
  • After the successful testing phase, Jenkins shares the results with the team using it.

****Improve Your Earning Potential Further!DevOps Engineer Masters ProgramEXPLORE PROGRAM

!https://www.simplilearn.com/ice9/banners/free_resources_banners/lead_banners/DevOps_Engineer.png

  1. What is Jenkinsfile?

Jenkins file is a text file that has a definition of a Jenkins pipeline and is checked into the source control repository. It enables code review and iteration on the pipeline. It also permits an audit trail for the pipeline.

  1. Differentiate between Maven, Ant, and Jenkins.

Maven

ANT

Jenkins

1. Build tool

  
  1. Perform build operations | 1. Build tool
  2. Perform build operations | 1. Continuous Integration tool
  3. Jenkins may run unit tests and deploy applications |
  1. Differentiate between Bamboo and Jenkins?

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

****Improve Your Earning Potential Further!DevOps Engineer Masters ProgramEXPLORE PROGRAM

!https://www.simplilearn.com/ice9/banners/free_resources_banners/lead_banners/DevOps_Engineer.png

  1. What is the difference between Jenkins and Hudson?

S.no

Jenkins

Hudson

1

Jenkins is a free open-source Continuous Integration server.

Hudson is an extensible Continuous Integration server

2

Forked by Hudson

Continuous Integration tool

3

Used by companies like Netflix, Facebook, eBay, Instacart, LinkedIn, etc.

Used by companies like Logo Yazilim, TableAir UAB and OptoSweden AB.

4

Jenkins supports a lot of plugins

Hudson supports a lesser number of plugins

  1. Why is Jenkins used with Selenium?

Using Selenium allows Jenkins’s testing whenever there are any software changes or any changes in the environment. When the Selenium test suite is integrated with Jenkins, the testing part is also automated as part of the build process.

  1. What is the process to integrate Git with Jenkins?

To integrate Git with Jenkins, you can follow the following steps:

  • First, create a new Jenkins job and open the Jenkins dashboard.
  • Now, enter the desired project name and select the job type.
  • Click on OK.
  • Then enter the project information.
  • After that, visit the ‘Source Code Management’ tab.

!https://www.simplilearn.com/ice9/free_resources_article_thumb/Jenkins_Git_Integration.JPG

Source: https://plugins.jenkins.io/git/

  • If the Git plugin is pre-installed in Jenkins, there will be ‘Git’.
  • If it is not installed, you must reinstall the plugins (GitHub plugin, GitHub Branch Source plugin, GitHub API plugin, Git client plugin, etc.).
  • After we install the plugins, restart Jenkins.
  • To check if Git is installed, you can go to Command Prompt and type Git, and you would see various options like usage, version, help, etc.
  1. Explain Kubernetes, and how can you integrate Jenkins with Kubernetes?
  • Kubernetes is a portable and open-source platform that is used for managing workloads and services that are containerized.
  • With the help of Kubernetes, the group of hosts running the Linux containers can be easily and efficiently managed.
  • To manage a Continuous Delivery (CD) pipeline, the most efficient way is to deploy Jenkins with Kubernetes Engine.
  • Kubernetes enables the creation of multiple container instances to satisfy more fault tolerance.
  • Kubernetes deploy plug may be used with Jenkins for Continuous Deployment.

****Improve Your Earning Potential Further!DevOps Engineer Masters ProgramEXPLORE PROGRAM

!https://www.simplilearn.com/ice9/banners/free_resources_banners/lead_banners/DevOps_Engineer.png

  1. What is DSL Jenkins?

DSL stands for Domain Specific Language. Jenkins job DSL is a plugin that allows us to define jobs in the programmatic form with minimal effort. You can describe your jobs in Jenkins using a Groovy Based Language. They designed Jenkins job DSL plugin to create versions of the job, manage the records

  1. 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
  1. What are some of the default environmental variables in Jenkins?

Some of the Jenkins environmental variables are:

  • $JOB_NAME – The name that you give your job when it is first set up.
  • $NODE_NAME – This is the name of the node on which the current build is running.
  • $WORKSPACE – Refers to the path of the workspace
  • $BUILD_URL – Indicates the URL where the results of the builds can be found.
  • $JENKINS_URL – This is set to the URL of the Jenkins master that is responsible for running the build.

Advance Level Jenkins Interview Questions

  1. What are some of the critical aspects of the Jenkins pipeline?

Some of the Jenkins Pipeline key aspects are:

  • Pipeline: User-defined model of a CD pipeline. Pipeline’s code takes the role of defining the entire build process, including building, testing, and delivering an application.
  • Node: A machine as a part of the Jenkins environment which is capable of executing a pipeline.

!https://www.simplilearn.com/ice9/free_resources_article_thumb/nodes_Jenkins_Pipeline.png

  • Step: An individual task that communicates to Jenkins about what to do at a particular point in time
  • Stage: This defines distinct subset of tasks that are conceptually unique and performed through the pipeline (build, test, deploy stages)

!https://www.simplilearn.com/ice9/free_resources_article_thumb/Jenkins_Pipeline_Flow.png

  1. Let’s say there is a broken build in the Jenkins project, then what can be done?

Initially, you will have to open the console output where the broken builds are created and then figure out if there are any file changes that were missed. In case there are no issues found there, then you will need to update your local workspace, replicate the problem, and then try to solve it.

Common

careers for Jenkins professionals

Automation engineer | DevOps engineer | Full stack developer

Upskill today with Jenkins course to not be left behind in your career!

  1. 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
  1. What is the process of making a Multibranch Pipeline in Jenkins?

To create a Multibranch Pipeline in Jenkins, follow the following steps:

  • Open the Jenkins dashboard and create a new item by clicking on ‘new item’
  • Enter the project name and, from the options, select ‘Multibranch pipeline’
  • Click on OK

!https://www.simplilearn.com/ice9/free_resources_article_thumb/Multibranch_Pipeline.JPG

Source: https://www.jenkins.io/doc/book/pipeline/multibranch/

  • Then select the repository location, branch source (GitHub/Bitbucket), and add the branch source credentials.
  • Save the project
  • Now, Jenkins automatically creates new Multibranch Pipelines for repositories
  • Then to connect to the GitHub repo, we need the HookURL
  • To get this URL from the repository settings, add this HookURL to the Webhooks section
  • Once the jobs are created, Jenkins will automatically trigger the build
  1. How can the parameters be defined in Jenkins?

In Jenkins, a build can take many input parameters to execute.

  • To define parameters for the job, select the “this project is parameterized” box.
  • The drop down “Add Parameter” is enabled with the parameter types list. Any number of parameters may be added in the list.

There are several parameter types provided in the list.

****Improve Your Earning Potential Further!DevOps Engineer Masters ProgramEXPLORE PROGRAM

!https://www.simplilearn.com/ice9/banners/free_resources_banners/lead_banners/DevOps_Engineer.png

  1. Explain the ways to configure Jenkins node agent to communicate with Jenkins master?

There are two ways to configure Jenkins node agent to communicate with Jenkins master:

  1. Browser–If we launch the Jenkins node agent from a browser, a Java Web Start or JNLP file is downloaded. The downloaded file launches a new process on the client machine to run jobs.
  2. Command-line–If you want to start the node agent using the command line, you need the executable agent.jar file. When this file runs, it launches a client’s process to communicate with the Jenkins master to run build jobs.
  1. What is the use of the JENKINS_HOME directory?
  • JENKINS_HOME directory is the place where all the settings, logs, and configurations are stored. It stores all this information in XML files.
  • The directory contains a subdirectory for every Jenkins build job being operated.
  • Every directory has two subdirectories: builds and workspace., and some other files as well.
  • These sub directories are important, as the workspace directory is located at the place where Jenkins is building the project, and it contains the source code.
  • The builds directory stores the history of all the builds performed for this job.

!https://www.simplilearn.com/ice9/free_resources_article_thumb/Jenkins_Home_Directory.png

  1. Explain a backup plugin and its uses.

It includes job configs, plugins, logs, plugin configuration, etc. Jenkins provides a backup plugin which can be used to get critical backup configuration. This is most important when there is a failure; it prevents the loss of any settings.

  1. What do you understand by a trigger concerning a pipeline?

A trigger is something that defines when and how the pipelines should be executed. There may be several triggers like a pull request trigger that is used to deploy a pull request, or there may be a stage trigger that is used in configuring how each stage in the release will be triggered.

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

The three mechanisms are as follows:

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