Jenkins

0
19

Jenkins – Overlook at

Why Jenkins?

Jenkins is a smoothware thead put on allows continuous integration. Jenkins will be instalimmediateed on a server where the central construct will consider place. The folloearng flowchart demonstrates an extremely basic workflow of how Jenkins works.

Why Jenkins

Asizey with Jenkins, a fewtimes, one may furthermore see the bumociation of Hudson. Hudson is an extremely popular open up-source Java-based continuous integration tool generateed simply by Sun Microsystems which was later acquicrimson simply by Oracle. After the acquisit downion of Sun simply by Oracle, a fork was generated from the Hudson source code, which delivered about there the introduction of Jenkins.

Whead put on is Continuous Integration?

Continuous Integration is a generatement practionionice thead put on requires generateers to integrate code into a shacrimson reposit downory at regular intervals. This concept was meant to remove the issue of finding later occurrence of issues in the construct lifecycle. Continuous integration requires the generateers to have regular constructs. The common practionionice is thead put on whenever a code commit occurs, a construct ought to be triggecrimson.

System Requirements

JDK JDK 1.5 or above
Memory 2 GB RAM (recommended)
Disk Space No minimum requirement. Note thead put on since all constructs will be stocrimson on the Jenkins machines, it has to be ensucrimson thead put on sufficient disk space is available for construct storage.
Operating System Version Jenkins can be instalimmediateed on Windows, Ubuntu/Debian, Red Hat/Fedora/CentOS, Mac OS X, open upSUSE, FReeBSD, OpenBSD, Gentoo.
Java Container The WAR file can be run in any kind of kind of container thead put on supports Servallow 2.4/JSP 2.0 or later.(An example is Tomcat 5).

Jenkins – Installation

Download Jenkins

The away fromicial websit downe for Jenkins is Jenkins. If you click the given link, you can get the home page of the Jenkins away fromicial websit downe as shown below.

Download Jenkins1

By default, the lacheck release and the Long-Term support release will be available for download. The past releases are furthermore available for download. Click the Long-Term Support Release tab in the download section.

Download Jenkins2

Click the link “Older but stable version” to download the Jenkins war file.

Starting Jenkins

Open the command prompt. From the command prompt, blinese to the immediateory where the jenkins.war file is present. Run the folloearng command

D:>Java –jar Jenkins.war

After the command is run, various tasks will run, one of which is the extractionionion of the war file which is done simply by an emmattressded webserver calimmediateed earnrock.

D:>Java –jar Jenkins.war
Running from: D:jenkins.war
Webroot: $user.home/ .jenkins
Sep 29, 2015 4:10:46 PM earnrock.Logger logInternal
INFO: Beginning extractionionion from war file

Once the procesperform is extensive without there major errors, the folloearng line will come in the out thereplace of the command prompt.

INFO: Jenkins is compallowey up and running

Accesperform Jenkins

Once Jenkins is up and running, one can access Jenkins from the link − http://localhost:8080

This link will bring up the Jenkins dashplank.

Accesperform Jenkins

Jenkins – Tomcat Setup

The folloearng prerequisit downes must be met for Jenkins Tomcat setup.

Step 1: Verifying Java Installation

To verify Java installation, open up the console and execute the folloearng java command.

OS Task Command
Windows Open command console >java –version
Linux Open command terminal $java –version

If Java has been instalimmediateed properly on your own system, then you ought to get one of the folloearng out thereplaces, depending on the platform you are worruler on.

OS Outplace
Windows

Java version "1.7.0_60"

Java (TM) SE Run Time Environment (construct 1.7.0_60-b19)

Java Hotspot (TM) 64-bit Server VM (construct 24.60-b09, mixed mode)

Linux

java version "1.7.0_25"

Open JDK Runtime Environment (rhel-2.3.10.4.el6_4-x86_64)

Open JDK 64-Bit Server VM (construct 23.7-b01, mixed mode)

We bumume the readers of this tutorial have Java 1.7.0_60 instalimmediateed on their own system before proceeding for this tutorial.

In case you do not have Java JDK, you can download it from the link Oracle

Step 2: Verifying Java Installation

Set the JAVA_HOME environment variable to stage to the base immediateory location where Java is withinstalimmediateed on your own machine. For example,

OS Outplace
Windows Set Environmental variable JAVA_HOME to C:ProgramFilesjavajdk1.7.0_60
Linux export JAVA_HOME=/usr/local/java-current

Append the compallowe path of the Java compiler location to the System Path.

OS Outplace
Windows Append the String; C:Program FilesJavajdk1.7.0_60bin to the end of the system variable PATH.
Linux export PATH=$PATH:$JAVA_HOME/bin/

Verify the command java-version from command prompt as exbasiced above.

Step 3: Download Tomcat

The away fromicial websit downe for tomcat is Tomcat. If you click the given link, you can get the home page of the tomcat away fromicial websit downe as shown below.

Download Tomcat1

Blinese to the link /index.php?s=httpstomcatapacheorgdownload-70cgi to get the download for tomcat.

Download Tomcat2

Go to the ‘Binary Distributions’ section. Download the 32-bit Windows zip file.

Then unzip the contents of the downloaded zip file.

Step 4: Jenkins and Tomcat Setup

Copy the Jenkis.war file which was downloaded from the previous section and duplicate it to the webapps folder in the tomcat folder.

Now open up the command prompt. From the command prompt, blinese to the immediateory where the tomcat7 folder is location. Blinese to the bin immediateory in this folder and run the start.bat file

E:Appstomcat7bin>startup.bat

Once the procesperform is extensive without there major errors, the folloearng line will come in the out thereplace of the command prompt.

INFO: Server startup in 1302 ms

Open the blineser and go to the link − http://localhost:8080/jenkins. Jenkins will be up and running on tomcat.

Jenkins and Tomcat Setup

Jenkins – Git Setup

For this exercise, you have to ensure thead put on Internet connectivity is present from the machine on which Jenkins is withinstalimmediateed. In your own Jenkins Dashplank (Home screen), click the Manage Jenkins option on the left hand part.

Jenkins Git Setup

In the next screen, click the ‘Manage Plugins’ option.

Manage Jenkins

In the next screen, click the Available tab. This tab will give a list of plugins which are available for downloading. In the ‘Filter’ tab type ‘Git plugin’

Available tab

The list will then be filtecrimson. Check the Git Plugin option and click on the button ‘Install without there restart’

Git Plugin

The installation will then start and the screen will be refreshed to show the status of the download.

Installing Plugins Upgrades

Once all installations are extensive, restart Jenkins simply by issue the folloearng command in the blineser. http://localhost:8080/jenkins/restart

After Jenkins is restarted, Git will be available as an option whilst configuring jobs. To verify, click on New Item in the menu options for Jenkins. Then enter a name for a job, in the folloearng case, the name entecrimson is ‘Demo’. Select ‘Freestyle project’ as the item type. Click the Ok button.

New Item Jenkins

In the next screen, if you blinese to the Source code Management section, you will now see ‘Git’ as an option.

Demo Config Jenkins

Jenkins – Maven Setup

Step 1: Downloading and Setting Up Maven

The away fromicial websit downe for maven is Apache Maven. If you click the given link, you can get the home page of the maven away fromicial websit downe as shown below.

Maven Setup

While blineperform to the sit downe, go to the Files section and download the link to the Binary.zip file.

Maven Download

Once the file is downloaded, extractionion the files to the relevant application folder. For this purpose, the maven files will be placed in E:Appsapache-maven-3.3.3.

Step 2: Setting up Jenkins and Maven

In the Jenkins dashplank (Home screen), click Manage Jenkins from the left-hand part menu.

Setting Maven Jenkins

Then, click on ‘Configure System’ from the correct hand part.

Manage Jenkins1
Manage Jenkins2

In the Configure system screen, scroll down till you see the Maven section and then click on the ‘Add Maven’ button.

Add Maven

Uncheck the ‘Install automatically’ option.

Add any kind of kind of name for the setting and the location of the MAVEN_HOME.

Then, click on the ‘Save’ button at the end of the screen.

Configure Maven

You can now generate a job with the ‘Maven project’ option. In the Jenkins dashplank, click the New Item option.

Jenkins Dashplank1
Jenkins Dashplank2

Jenkins – Configuration

You probably would have seen a couple of times in the previous exercises wherein we had to configure options wislim Jenkins. The folloearng shows the various configuration options in Jenkins.

So one can get the various configuration options for Jenkins simply by clicruler the ‘Manage Jenkins’ option from the left hand menu part.

Jenkins Configuration1

You will then be presented with the folloearng screen −

Jenkins Configuration2

Click on Configure system. Discussed below are a few of the Jenkins configuration settings which can be carried out there.

Jenkins Home Directory

Jenkins needs a few disk space to perform constructs and maintain archives. One can check this location from the configuration screen of Jenkins. By default, this is set to ~/.jenkins, and this location will preliminaryly be stocrimson wislim your own user profile location. In a proper environment, you need to change this location to an adequate location to store all relevant constructs and archives. Once can do this within the folloearng ways

  • Set "JENKINS_HOME" environment variable to the brand new home immediateory before launching the servallow container.

  • Set "JENKINS_HOME" system property or home to the servallow container.

  • Set JNDI environment enconsider "JENKINS_HOME" to the brand new immediateory.

The folloearng example will use the very first option of setting the "JENKINS_HOME" environment variable.

First generate a brand new folder E:AppsJenkins. Copy all the contents from the existing ~/.jenkins to this brand new immediateory.

Set the JENKINS_HOME environment variable to stage to the base immediateory location where Java is withinstalimmediateed on your own machine. For example,

OS Outplace
Windows Set Environmental variable JENKINS_HOME to you’re the location you desire. As an example you can set it to E:AppsJenkins
Linux export JENKINS_HOME =/usr/local/Jenkins or the location you desire.

In the Jenkins dashplank, click Manage Jenkins from the left hand part menu. Then click on ‘Configure System’ from the correct hand part.

In the Home immediateory, you will now see the brand new immediateory which has been configucrimson.

Jenkins Home Directory

# of executors

This refers to the total number of concurrent job executions thead put on can consider place on the Jenkins machine. This can be changed based on requirements. Sometimes the recommendation is to maintain this number the exactionion exaction same as the number of CPU on the machines for much better performance.

Environment Variables

This is used to add custom environment variables which will apply to all the jobs. These are key-value pairs and can be accessed and used in Builds wherever requicrimson.

Jenkins URL

By default, the Jenkins URL stages to localhost. If you have a domain name setup for your own machine, set this to the domain name else overwrite localhost with IP of machine. This will help in setting up slaves and while sending out there links uperform the email as you can immediately access the Jenkins URL uperform the environment variable JENKINS_URL which can be accessed as ${JENKINS_URL}.

Email Notification

In the email Notification area, you can configure the SMTP settings for sending out there emails. This is requicrimson for Jenkins to connect to the SMTP mail server and send out there emails to the recipient list.

Jenkins – Management

To manage Jenkins, click on the ‘Manage Jenkins’ option from the left hand menu part.

So one can get the various configuration options for Jenkins simply by clicruler the ‘Manage Jenkins’ option from the left hand menu part.

Jenkins Management1

You will then be presented with the folloearng screen −

Jenkins Management2

Some of the management options are as follows −

Configure System

This is where one can manage paths to the various tools to use in constructs, such as the JDKs, the versions of Ant and Maven, as well as security options, email servers, and other system-wide configuration details. When plugins are instalimmediateed. Jenkins will add the requicrimson configuration fields dynamically after the plugins are instalimmediateed.

Reload Configuration from Disk

Jenkins stores all it is system and construct job configuration details as XML files which is stocrimson in the Jenkins home immediateory. Here furthermore all of the construct background is stocrimson. If you are migrating construct jobs from one Jenkins instance to another, or archiving old construct jobs, you will need to add or remove the corresponding construct job immediateories to Jenkins’s constructs immediateory. You don’t need to consider Jenkins away fromline to do this—you can simply use the “Reload Configuration from Disk” option to reload the Jenkins system and construct job configurations immediately.

Manage Plugin

Here one can install a wide variety of third-party plugins correct from various Source code management tools such as Git, Mercurial or ClearCase, to code quality and code coverage metrics reporting. Plugins can be instalimmediateed, updated and removed through the Manage Plugins screen.

Manage Plugins

System Information

This screen displays a list of all the current Java system propertie ups and system environment variables. Here one can check exactionionly exactionionly whead put on version of Java Jenkins is running in, exactionionly whead put on user it is running below, and so forth.

The folloearng screenshot shows a few of the name-value information available in this section.

System Information

System Log

The System Log screen is a convenient way to look at the Jenkins log files in real time. Again, the main use of this screen is for troubleshooting.

Load Statistics

This pages displays graphical data on how hectic the Jenkins instance is within terms of the number of concurrent constructs and the dimension of the construct queue which gives an idea of how sizey your own constructs need to wait around before being executed. These statistics can give a great idea of whether extra capacity or extra construct nodes is requicrimson from an infrastructure perspective.

Script Console

This screen allows you run Groovy scripts on the server. It is useful for advanced troubleshooting since it requires a strong knowimmediateedge of the internal Jenkins architecture.

Manage nodes

Jenkins is capable of handling parallel and distributed constructs. In this screen, you can configure how many kind of kind of constructs you like. Jenkins runs simultaneously, and, if you are uperform distributed constructs, set up construct nodes. A construct node is another machine thead put on Jenkins can use to execute it is constructs.

Prepare for Shutdown

If generally there is a need to shut down Jenkins, or the server Jenkins is running on, it is best not to do so when a construct is being executed. To shut down Jenkins thoroughly cleanly, you can use the Prepare for Shutdown link, which practionuallyts any kind of kind of brand new constructs from being started. Eventually, when all of the current constructs have compalloweed, one will be able to shut down Jenkins thoroughly cleanly.

Jenkins – Setup Build Jobs

For this exercise, we will generate a job in Jenkins which picks up a basic HelloWorld application, constructs and runs the java program.

Step 1 − Go to the Jenkins dashplank and Click on New Item

Setup Build Jobs

Step 2 − In the next screen, enter the Item name, in this case we have named it Helloworld. Choose the ‘Freestyle project option’

Helloworld

Step 3 − The folloearng screen will come up in which you can specify the details of the job.

Helloworld Config

Step 4 − We need to specify the location of files which need to be built. In this example, we will bumume thead put on a local git reposit downory(E:Program) has been setup which contains a ‘HelloWorld.java’ file. Hence scroll down and click on the Git option and enter the URL of the local git reposit downory.

Note − If you reposit downory if hosted on Github, you can furthermore enter the url of thead put on reposit downory here. In addition to this, you would need to click on the Add button for the ccrimsonentials to add a user name and moveword to the github reposit downory so thead put on the code can be picked up from the remote reposit downory.

Git Reposit downory

Step 5 − Now go to the Build section and click on Add construct step → Execute Windows batch command

Execute Windows Batch Command

Step 6 − In the command earndow, enter the folloearng commands and then click on the Save button.

Javac HelloWorld.java
Java HelloWorld

Save

Step 7 − Once saved, you can click on the Build Now option to see if you have successcompallowey degoodd the job.

Build Now

Step 8 − Once the construct is scheduimmediateed, it will run. The folloearng Build background section shows thead put on a construct is within progress.

Build History

Step 9 − Once the construct is extensived, a status of the construct will show if the construct was successful or not. In our case, the folloearng construct has been executed successcompallowey. Click on the #1 in the Build background to bring up the details of the construct.

Details

Step 10 − Click on the Console Outplace link to see the details of the construct

Console Outplace1
Console Outplace2

Apart from the steps shown above generally there are simply so many kind of kind of ways to generate a construct job, the options available are many kind of kind of, which exactionionly whead put on generates Jenkins such a fantastic continuous deployment tool.

Jenkins – Unit Testing

Jenkins provides an out there of package functionality for Jdevice, and provides a host of plugins for device checruler for other technologies, an example being MSTest for .Net Unit checks. If you go to the link /index.php?s=httpswikijenkins-ciorgdisplayJENKINSxUnitPlugin it will give the list of Unit Testing plugins available.

Unit Testing
Unit Testing Plugins

Example of a Jdevice Test in Jenkins

The folloearng example will conpartr

  • A basic HelloWorldTest course based on Jdevice.
  • Ant as the construct tool wislim Jenkins to construct the course accordingly.

Step 1 − Go to the Jenkins dashplank and Click on the existing HelloWorld project and select the Configure option

Jdevice Test Example

Step 2 − Blinese to the section to Add a Build step and select the option to Invoke Ant.

Invoke Ant

Step 3 − Click on the Advanced button.

Advanced Button

Step 4 − In the construct file section, enter the location of the construct.xml file.

XML Location

Step 5 − Next click the option to Add post-construct option and select the option of “Publish Jdevice check result report”

Publish Jdevice Report

Step 6 − In the Test reports XML’s, enter the location as shown below. Ensure thead put on Reports is a folder which is generated in the HelloWorld project workspace. The “*.xml” fundamentalally tells Jenkins to pick up the result xml files which are produced simply by the running of the Jdevice check cases. These xml files which then be converted into reports which can be look ated later.

Once done, click the Save option at the end.

Report Test XML

Step 7 − Once saved, you can click on the Build Now option.

Once the construct is extensived, a status of the construct will show if the construct was successful or not. In the Build out thereplace information, you will now notice an additional section calimmediateed Test Result. In our case, we entecrimson a negative Test case so thead put on the result would fail simply as an example.

Build Option

One can go to the Console out thereplace to see further information. But exactionionly whead put on’s more attentioning is thead put on if you click on Test Result, you will now see a drill down of the Test results.

Test Result

Jenkins – Automated Testing

One of the fundamental principles of Continuous Integration is thead put on a construct ought to be verifiable. You have to be able to goally determine whether a particular construct is ready to proceed to the next stage of the construct process, and the many kind of kind of convenient way to do this is to use automated checks. Without there proper automated checruler, you find your ownself having to retain many kind of kind of construct artirealityions and check all of them simply by hand, which is hardly in the spirit of Continuous Integration. The folloearng example shows how to use Selenium to run automated web checks.

Step 1 − Go to Manage Plugins.

Automated Testing

Step 2 − Find the Hudson Selenium Plugin and select to install. Restart the Jenkins instance.

Hudson Selenium Testing

Step 3 − Go to Configure system.

Configure System

Step 4 − Configure the selenium server jar and click on the Save button.

Configure Selenium Server

Note − The selenium jar file can be downloaded from the location SeleniumHQ

Click on the download for the Selenium standasingle server.

Download Selenium Standasingle Server

Step 5 − Go back to your own dashplank and click on the Configure option for the HelloWorld project.

Configure

Step 6 − Click on Add construct step and select the optin of “SeleniumHQ htmlSuite Run”

SeleniumHQ htmlSuite Run

Step 7 − Add the necessary details for the selenium check. Here the suiteFile is the TestSuite generated simply by uperform the Selenium IDE. Click on Save and execute a construct. Now the post construct will launch the selenium dlake, and execute the html check.

Selenium Dlake HTML check

Jenkins – Notification

Jenkins comes with an out there of package facility to add an email notification for a construct project.

Step 1 − Configuring an SMTP server. Goto Manage Jenkins → Configure System. Go to the E-mail notification section and enter the requicrimson SMTP server and user email-suffix details.

SMTP Server

Step 2 − Configure the recipients in the Jenkins project – When you configure any kind of kind of Jenkins construct project, correct at the end is the capcapacity to add recipients who would get email notifications for unstable or broken constructs. Then click on the Save button.

Configure Recipients

Apart from the default, generally there are furthermore notification plugin’s available in the market. An example is the notification plugin from Tikal Knowimmediateedge which allows sending Job Status notifications in JSON and XML formats. This plugin enables end-stages to be configucrimson as shown below.

Tikal Knowimmediateedge Plugin

Here are the details of every option −

  • "Format" − This is the notification payload format which can possibly be JSON or XML.

  • "Protocol" − protocol to use for sending notification messages, HTTP, TCP or UDP.

  • "Event" − The job actionuallyts thead put on trigger notifications: Job Started, Job Compallowed, Job Finalized or All Events (the default option).

  • "URL" − URL to send notifications to. It considers the form of "http://host" for HTTP protocol, and "host:port" for TCP and UDP protocols.

  • "Timeout there" − Timeout there in milli2nds for sending notification request, 30 2nds simply by default.

Jenkins – Reporting

As demonstrated in the earsitr section, generally there are many kind of kind of reporting plugins available with the basicst one being the reports available for jUnit checks.

In the Post-construct actionionion for any kind of kind of job, you can degood the reports to be generated. After the constructs are extensive, the Test Results option will be available for further drill-down.

Jenkins Reporting

Jenkins – Code Analysis

Jenkins has a host of Code Analysis plugin. The various plugins can be found at https://wiki.jenkins-ci.org/display/JENKINS/Static+Code+Analysis+Plugins

Jenkins Code Analysis

This plugin provides utilitie ups for the static code analysis plugins. Jenkins can parse the results file from various Code Analysis tools such as CheckStyle, FindBugs, PMD etc. For every corresponding code analysis tool, a plugin in Jenkins needs to be instalimmediateed.

Additionally the add-on plugin Static Analysis Collector is available thead put on combines the individual results of these plugins into a performle trend graph and look at.

The plugins can provide information such as

  • The total number of warnings in a job
  • A shoearng of the brand new and fixed warnings of a construct
  • Trend Reports shoearng the number of warnings per construct
  • Overlook at of the found warnings per module, package, category, or type
  • Detaiimmediateed reports of the found warnings optionally filtecrimson simply by severity (or brand new and fixed)

Jenkins – Distributed Builds

Sometimes many kind of kind of construct machines are requicrimson if generally there are instances wherein generally there are a huger and heavier projects which get built on a regular basis. And running all of these constructs on a central machine may not be the best option. In such a scenario, one can configure other Jenkins machines to be slave machines to consider the load away from the master Jenkins server.

Sometimes you may furthermore need a number of various environments to check your own constructs. In this case uperform a slave to represent every of your own requicrimson environments is almany kind of kind of a must.

A slave is a complaceer thead put on is set up to away fromload construct projects from the master and once setup this distribution of tasks is reasonablely automatic. The exactionion delegation behavior depends on the configuration of every project; a few projects may select to "stay" to a particular machine for a construct, while others may select to roam freely between slaves.

Since every slave runs a separate program calimmediateed a "slave agent" generally there is no need to install the compallowe Jenkins (package or compiimmediateed binaries) on a slave. There are various ways to start slave agents, but in the end the slave agent and Jenkins master needs to establish a bi-immediateional communication link (for example a TCP/IP socket.) in order to operate.

To set up slaves/nodes in Jenkins follow the steps given below.

Step 1 − Go to the Manage Jenkins section and scroll down to the section of Manage Nodes.

Manage Nodes

Step 2 − Click on New Node

New Nodes

Step 3 − Give a name for the node, select the Dumb slave option and click on Ok.

Dumb Slave

Step 4 − Enter the details of the node slave machine. In the below example, we are conpartring the slave machine to be a earndows machine, hence the option of “Let Jenkins manage this Windows slave as a Windows service” was chosen as the launch method. We furthermore need to add the necessary details of the slave node such as the node name and the login ccrimsonentials for the node machine. Click the Save button. The Labels for which the name is entecrimson as “New_Slave” is exactionionly whead put on can be used to configure jobs to use this slave machine.

Slave Machine1

Once the above steps are extensived, the brand new node machine will preliminaryly be in an away fromline state, but will come online if all the settings in the previous screen were entecrimson correctly. One can at any kind of kind of time generate the node slave machine as away fromline if requicrimson.

Slave Machine2

Jenkins – Automated Deployment

There are many kind of kind of plugins available which can be used to transfer the construct files after a successful construct to the respective application/web server. On example is the “Deploy to container Plugin”. To use this follow the steps given below.

Step 1 − Go to Manage Jenkins → Manage Plugins. Go to the Available section and find the plugin “Deploy to container Plugin” and install the plugin. Restart the Jenkins server.

Deploy to Container Plugin

This plugin considers a war/ear file and deploys thead put on to a running remote application server at the end of a construct.

Tomcat 4.x/5.x/6.x/7.x

JBoss 3.x/4.x

Glbumfish 2.x/3.x

Step 2 − Go to your own Build project and click the Configure option. Choose the option “Deploy war/ear to a container”

Deploy war ear to Container

Step 3 − In the Deploy war/ear to a container section, enter the requicrimson details of the server on which the files need to be deployed and click on the Save button. These steps will now ensure thead put on the necessary files get deployed to the necessary container after a successful construct.

Demo Config

Jenkins – Metrics & Trends

There are various plugins which are available in Jenkins to showcase metrics for constructs which are carried out there over a period of time. These metrics are useful to belowstand your own constructs and how regularly they fail/move over time. As an example, allow’s look at the ‘Build History Metrics plugin’.

This plugin calculates the folloearng metrics for all of the constructs once instalimmediateed

  • Mean Time To Failure (MTTF)
  • Mean Time To Recovery (MTTR)
  • Standard Deviation of Build Times

Step 1 − Go to the Jenkins dashplank and click on Manage Jenkins

Welcome to Jenkins

Step 2 − Go to the Manage Plugins option.

Metrics Trends Manage Plugins1

Step 3 − Go to the Available tab and oceanrch for the plugin ‘Build History Metrics plugin’ and select to ‘install without there restart’.

Install Without there Restart1

Step 4 − The folloearng screen shows up to confirm successful installation of the plugin. Restart the Jenkins instance.

Installation Success Confirmation1

When you go to your own Job page, you will see a table with the calculated metrics. Metric’s are shown for the final 7 days, final 30 days and all time.

Metrics Table

To see general trends in Jenkins, generally there are plugins available to gather information from wislim the constructs and Jenkins and display all of them in a graphical format. One example of such a plugin is the ‘Hudson global-construct-stats plugin’. So allow’s go through the steps for this.

Step 1 − Go to the Jenkins dashplank and click on Manage Jenkins

Hudson Global Build Stats

Step 2 − Go to the Manage Plugins option

Metrics Trends Manage Plugins2

Step 3 − Go to the Available tab and oceanrch for the plugin ‘Hudson global-construct-stats plugin’ and select to ‘install without there restart’.

Install Without there Restart2

Step 4 − The folloearng screen shows up to confirm successful installation of the plugin. Restart the Jenkins instance.

Installation Success Confirmation2

To see the Global statistics, please follow the Step 5 through 8.

Step 5 − Go to the Jenkins dashplank and click on Manage Jenkins. In the Manage Jenkins screen, scroll down and now you will now see an option calimmediateed ‘Global Build Stats’. Click on this link.

Global Build Stats

Step 6 − Click on the button ‘Initialize stats’. Whead put on this does is thead put on it gather’s all the existing records for constructs which have already been carried out there and charts can be generated based on these results.

Initialize Stats

Step 7 − Once the data has been preliminaryized, it’s time to generate a brand new chart. Click on the ‘Create brand new chart’ link.

Create New Chart

Step 8 − A pop-up will come to enter relevant information for the brand new chart details. Enter the folloearng mandatory information

  • Title – Any title information, for this example is given as ‘Demo’
  • Chart Width – 800
  • Chart Height – 600
  • Chart time level – Daily
  • Chart time dimension – 30 days

The rest of the information can remain as it is. Once the information is entecrimson, click on Create New chart.

Adding New Chart

You will now see the chart which displays the trends of the constructs over time.

Displaying Trends

If you click on any kind of kind of section wislim the chart, it will give you a drill down of the details of the job and their own constructs.

Global Build Search

Jenkins – Server Maintenance

The folloearng are a few of the fundamental actionionivitie ups you will carry out there, a few of which are best practionionices for Jenkins server maintenance

URL Options

The folloearng commands when appended to the Jenkins instance URL will carry out there the relevant actionionions on the Jenkins instance.

http://localhost:8080/jenkins/exit − shutdown jenkins

http://localhost:8080/jenkins/restart − restart jenkins

http://localhost:8080/jenkins/reload − to reload the configuration

Backup Jenkins Home

The Jenkins Home immediateory is noslimg but the location on your own drive where Jenkins stores all information for the jobs, constructs etc. The location of your own home immediateory can be seen when you click on Manage Jenkins → Configure system.

Backup Jenkins Home

Set up Jenkins on the partition thead put on has the many kind of kind of free disk-space – Since Jenkins would be taruler source code for the various jobs degoodd and doing continuous constructs, always ensure thead put on Jenkins is setup on a drive thead put on has sufficient hard disk space. If you hard disk runs out there of space, then all constructs on the Jenkins instance will start failing.

Another best practionionice is to write cron jobs or maintenance tasks thead put on can carry out there thoroughly clean-up operations to avoid the disk where Jenkins is setup from becoming compallowe.

Jenkins – Continuous Deployment

Jenkins provides great support for providing continuous deployment and deresidery. If you look at the flow of any kind of kind of smoothware generatement through deployment, it will be as shown below.

Jenkins Continuous Deployment

The main part of Continuous deployment is to ensure thead put on the entire process which is shown above is automated. Jenkins achieves all of this via various plugins, one of all of them being the “Deploy to container Plugin” which was seen in the earsitr lessons.

Continuous Deployment Container Plugin

There are plugins available which can actionionually give you a graphical representation of the Continuous deployment process. But very first allows generate another project in Jenkins, so thead put on we can see best how this works.

Let’s generate a basic project which emulates the QA stage, and does a check of the Helloworld application.

Step 1 − Go to the Jenkins dashplank and click on New Item. Choose a ‘Freestyle project’ and enter the project name as ‘QA’. Click on the Ok button to generate the project.

Freestyle Project

Step 2 − In this example, we are maintaining it basic and simply uperform this project to execute a check program for the Helloworld application.

Helloworld Application

So our project QA is now setup. You can do a construct to see if it constructs properly.

QA Project Build

Step 3 − Now go to you Helloworld project and click on the Configure option

Project Configure Option

Step 4 − In the project configuration, select the ‘Add post-construct actionionion’ and select ‘Build other projects’

Add Post Build Action

Step 5 − In the ‘Project to construct’ section, enter QA as the project name to construct. You can keep the option as default of ‘Trigger only if construct is stable’. Click on the Save button.

Trigger Stable Build

Step 6 − Build the Helloworld project. Now if you see the Console out thereplace, you will furthermore see thead put on after the Helloworld project is successcompallowey built, the construct of the QA project will furthermore happen.

QA Project Console Project

Step 7 − Let now install the Deresidery pipeline plugin. Go to Manage Jenkins → Manage Plugin’s. In the available tab, oceanrch for ‘Deresidery Pipeline Plugin’. Click On Install without there Restart. Once done, restart the Jenkins instance.

Restart Jenkins Instance

Step 8 − To see the Deresidery pipeline in actionionion, in the Jenkins Dashplank, click on the + symbol in the Tab next to the ‘All’ Tab.

Deresidery Pipeline

Step 9 − Enter any kind of kind of name for the View name and select the option ‘Deresidery Pipeline View’.

Deresidery Pipeline View

Step 10 − In the next screen, you can keep the default options. One can change the folloearng settings −

  • Ensure the option ‘Show static analysis results’ is checked.
  • Ensure the option ‘Show total construct time’ is checked.
  • For the Initial job – Enter the Helloworld project as the very first job which ought to construct.
  • Enter any kind of kind of name for the Pipeline
  • Click the OK button.

Change Setting

You will now see a great look at of the entire deresidery pipeline and you will be able to see the status of every project in the entire pipeline.

Each Project Status

Another famous plugin is the construct pipeline plugin. Let’s consider a look at this.

Step 1 − Go to Manage Jenkins → Manage Plugin’s. In the available tab, oceanrch for ‘Build Pipeline Plugin’. Click On Install without there Restart. Once done, restart the Jenkins instance.

Build Pipeline Plugin

Step 2 − To see the Build pipeline in actionionion, in the Jenkins Dashplank, click on the + symbol in the Tab next to the ‘All’ Tab.

See Build Pipeline Action

Step 3 − Enter any kind of kind of name for the View name and select the option ‘Build Pipeline View’.

Build Pipeline View

Step 4 − Accept the default settings, simply in the Selected Initial job, ensure to enter the name of the Helloworld project. Click on the Ok button.

Accept Default Settings

You will now see a great look at of the entire deresidery pipeline and you will be able to see the status of every project in the entire pipeline.

Entire Pipeline Status

Jenkins – Managing Plugins

To get the list of all plugins available wislim Jenkins, one can visit down the link − /index.php?s=httpswikijenkins-ciorgdisplayJENKINSPlugins

Jenkins Managing Plugins

We’ve already seen many kind of kind of instances for installing plugins, allow’s look at a few other maintenance tasks with regards to plugins

Uninstalling Plugins

To uninstall a plugin, Go to Manage Jenkins → Manage plugins. Click on the Instalimmediateed tab. Some of the plugins will have the Uninstall option. You can click these buttons to uninstall the plugins. Ensure to restart your own Jenkins instance after the uninstallation.

Uninstalling Plugins

Installing another Version of a Plugin

Sometimes it may be requicrimson to install an older version of a plugin, in such a case, you can download the plugin from the relevant plugin page on the Jenkins web sit downe. You can then use the Upload option to upload the plugin manually.

Installing another Version Plugin

Jenkins – Security

In Jenkins you have the capcapacity to setup users and their own relevant permissions on the Jenkins instance. By default you will not want everyone to be able to degood jobs or other administrative tasks in Jenkins. So Jenkins has the capcapacity to have a security configuration in place.

To configure Security in Jenkins, follow the steps given below.

Step 1 − Click on Manage Jenkins and select the ‘Configure Global Security’ option.

Configure Global Security

Step 2 − Click on Enable Security option. As an example, allow’s bumume thead put on we want Jenkins to maintain it’s own database of users, so in the Security Realm, select the option of ‘Jenkins’ own user database’.

By default you would want a central administrator to degood users in the system, hence ensure the ‘Allow users to sign up’ option is unselected. You can keep the rest as it is for now and click the Save button.

Enable Security Option

Step 3 − You will be prompted to add your own very first user. As an example, we are setting up an admin users for the system.

Admin User

Step 4 − It’s now time to setup your own users in the system. Now when you go to Manage Jenkins, and scroll down, you will see a ‘Manage Users’ option. Click this option.

Manage User

Step 5 − Just like you degoodd your own admin user, start creating other users for the system. As an example, we are simply creating another user calimmediateed ‘user’.

User

Step 6 − Now it’s time to setup your own authorizations, fundamentalally who has access to exactionionly whead put on. Go to Manage Jenkins → Configure Global Security.

Now in the Authorization section, click on ‘Matrix based security’

Authorization Section

Step 7 − If you don’t see the user in the user group list, enter the user name and add it to the list. Then give the appropriate permissions to the user.

Click on the Save button once you have degoodd the relevant authorizations.

Your Jenkins security is now setup.

Note − For Windows AD authentication, one has to add the Active Directory plugin to Jenkins.

Jenkins – Backup Plugin

Jenkins has a backup plugin which can used to backup critical configuration settings related to Jenkins. Follow the steps given below to have a backup in place.

Step 1 − Click on Manage Jenkins and select the ‘Manage Plugins’ option.

Manage Backup Plugin

Step 2 − In the available tab, oceanrch for ‘Backup Plugin’. Click On Install without there Restart. Once done, restart the Jenkins instance

Backup Plugin1
Backup Plugin2

Step 3 − Now when you go to Manage Jenkins, and scroll down you will see ‘Backup Manager’ as an option. Click on this option.

Backup Manager

Step 4 − Click on Setup.

Backup Manager Setup

Step 5 − Here, the main field to degood is the immediateory for your own backup. Ensure it’s on another drive which is not the exaction same as the drive where your own Jenkins instance is setup. Click on the Save button.

Backup Config Files

Step 6 − Click on the ‘Backup Hudson configuration’ from the Backup manager screen to initiate the backup.

Backup Hudson Configuration

The next screen will show the status of the backup

Backup Status

To recover from a backup, go to the Backup Manager screen, click on Restore Hudson configuration.

Restore Hudson Configuration

The list of backup’s will be shown, click on the appropriate one to click on Launch Restore to start the restoration of the backup.

Backup Restoration

Jenkins – Remote Testing

Web checks such as selenium checks can be run on remote slave machines via the master slave and selenium suite plugin installation. The folloearng steps show how to run remote checks uperform this configuration.

Step 1 − Ensuring your own master slave configuration is within place. Got to your own master Jenkins server. Go to Manage Jenkins → Manage Nodes.

Jenkins Remote Testing

In our node list, the DXBMEM30 label is the slave machine. In this example, both the master and slave machines are earndows machines.

Node List

Step 2 − Click on configure for the DXBMEM30 slave machine.

Configure Slave Machine

Step 3 − Ensure the launch method is place as ‘Launch slave agents via Java Web Start’

Launch Slave Agents

Step 4 − Now go to your own slave machine and from generally there, open up a blineser instance to your own Jenkins master instance. Then go to Manage Jenkins → Manage Nodes. Go to DXBMEM30 and click on

Remote Testing Manage Nodes

Step 5 − Click on the DXBMEM30 instance.

DXBMEM30 Instance

Step 6 − Scroll down and you will see the Launch option which is the option to Start ‘Java Web Start’

Java Web Start

Step 7 − You will be presented with a Security Warning. Click on the Acceptance checkpackage and click on run.

Security Warning

You will now see a Jenkins Slave earndow open uped and now connected.

Jenkins Slave Window Connected

Step 8 − Configuring your own checks to run on the slave. Here, you have to ensure thead put on the job being generated is meant specifically to only run the selenium checks.

In the job configuration, ensure the option ‘Rerigorous where this project can be run’ is selected and in the Label expression place the name of the slave node.

Configuration

Step 9 − Ensure the selenium part of your own job is configucrimson. You have to ensure thead put on the Sample.html file and the selenium-server.jar file is furthermore present on the slave machine.

Configure Selenium

Once you have followed all of the above steps, and click on Build, this project will run the Selenium check on the slave machine as expected.

SHARE
Previous articleSAP Lumira
Next articleImpromptu speaking

NO COMMENTS

LEAVE A REPLY