Skip to main content

what is jenkins ?

Jenkins is a self-contained, open source automation server which can be used to automate all sorts of tasks such as building, testing, and deploying software.

Jenkins can be  installed through native system packages, Docker, or even run standalone by any machine with the java Runtime Environment installed.


Is Jenkins is like TFS ?

Well, yes in many ways, since jenkins is a continuous integration tools, but still lacks many other areas where TFS is much more broader than jenkins, since TFS is more of a


  1. Version Control System.
  2. Requirements management system.
  3. Project management system
  4. automated build management system
  5. Testing and release management system.
  6. All, the above is otherwise called as Application Lifecycle Management System.

Part 2 : Installing and getting started with jenkins 2.0

Software pre-requisite 

We need to have following softwares installed before getting started with jenkins 2.0

  1. Java (latest is good)
  2. Jenkins war file
  3. Support tools
  4. Maven 
  5. Nunit
  6. Nuget
  7. Git

For Testing we can integrate plugins like JIRA

How to install jenkins in windows 10 

1) Download war file like LTS. 
to run this jar file we don't require any Database and all we have to run this war file using java.

To test weather java exisit or not 
java -version.


Now go to download directory and run cmd in administration mode 

Note in windows now run this command : C:\jenkins>java -jar jenkins.war

after this command you will get a password at the end of everything. this password is required when you first time start the jenkins.

default port for jenkins is 8080 so now we installed now we have to go to browser

localhost:8080 now jenkins will take you to login page

Now it will ask you Unlock Jenkins

enter password that you copied from cmd. 

After that it will ask you 1) Install suggested plugins 2) Select plugins to install 
so hit the select plugins to install.


while doing this in cmd you will notice a path like C:/Users/Win10/.jenkins/   this is most important folder where jenkins will keep all important file that jenkins required. this is like a database for jenkins this will holds all the plugins in plugins folder that we installed. 

Note: It will also create a project folder for you in this place and keep all the project repository that you complied and build.

Note: If you want to delete jenkins completely then you can delete this folder then it will automatically delete and now you can start from new one.


After Installation complete it will ask you Create First Admin User and will ask basic details like 
1) Username
2) Password
3) Confirm Password 
4) Full Name
5)  Email address.



Part 3 - Configuring Jenkins 2.0

Till now we just installed the plugins but we did not configure anything 

Now we go to Jenkins dashboard 

Click On Manage Jenkins

IN Configure Global Security we can define JNLP agent port so that Jenkins can run multiple jobs in different machines.


Now Go to Manage Jenkins > Global Tools Configuration  this is very important where we are going to do lots of configurations.


Git is used if you want to compile a project from Github then we have to configure this one.

We can also configure JDK 

Note: If environment variable set in Windows Machine, then we don't have to configure these.

Part 4  - Download Common tools used for Jenkins 2.0
  1. Git
  2. Nuget
  3. Maven (After installation set enviromental varibale in machine by defining like M2_Home = C:\tools\apache-maven-3.3.0 and define M2 = C:\tools\apache-maven-3.3.0\bin)
  4. Nunit
Important plugins now download and install git & maven.

After installation go to Global Tool Configuration and go Git and define the name any logical name and path like : C:\ProgramFiles\Git\bin\git.exe for windows

Similarly we can set JDK path as well as


Now Suppose you have git project on github and you have installed git in your local system now you want to clone your project from github to local then what you have to do 

1) Create a folder in your local machine.
now go to this particular folder and run cmd from that particular location and run a command like 

C:\gitpull>git clone url_of_project_from_github (this is manula task but we can automate this compile and build and run by creating a jobs in jenkins)

so we have to create a job for that.


Part 6 - Creating Freestyle project using Jenkins 2.0

Now Create New Jobs -> Select Freestyle Project

General : Define Project Name and Description 

Source Code Management : Like Setup Git, Subversion (These are for getting source code of project from following source and then compiling )

Build Trigger : 

Build : this is for to build the download project by using like maven (if we select the maven then we have to define the following properties like Goals - compile, test, clean, package ) then we have to define POM file if its on different file structure otherwise its ok.


Build Environment 


After this if we want to build this project then we have to use "Build Now" option form left side of dashboard.

If something failed then we can see at "console output " 

Part 7  - Creating Freestyle Project using Jenkins 2.0 for Build + Test
In this tutorial we are going to integrate testing as well as. 

Part 8 - Creating Pipeline Project Using Jenkins 2.0 for Build + Test + Reporting

Pipeline is the future of Jenkins 2.0

Jenkinfile is written using groovy.

For this we have to choose project rather then Freestyle Project to "Pipeline Project" 


While choose we have to define Pipeline commands for that i have to use different Pipline command that can be generated by build in option provide by jenkins we can auto generate the syntax.

1) first we have to define svn/git pipline command. 
2) We have to define maven command first we have to select General Build Step > (If we don't see then we can define batch script command for windows similarly for ubuntu or linux. like : mvn compile then generate pipline command )

After this if you build and get an error like 



Perhaps you forgot to surround the code with a step that provides this, such as :node



we have to create a node in pipeline and that node we have to put our git ,svn ,mvn , commands.



Note : As we can see we have Build Executor basically if we click on Build Eecutor we can see we have a master build executor. which is having 2 executors here. this master is called as Node. which basically inside your master machine. If you have many no of nodes. you can just configure them as different nodes. to perform different executors/execution. We can also crate a new node/different node and can scale out these nodes setting in  different machine  


Part 9 - Creating Pipeline project using Jenkins 2.0 for Build + Test + Reporting 
for reporting we can integrate cucumber reports plugin in jenkins.


Part 10 - Creating stages in Pipeline project using Jenkins 2.0

are very help to view the progress of every steps happing in pipeline.

we can do it by adding following line of code in pipeline



Part 15 : Configuring Email Notification with Jenkins 2.0

till now we have created freestyle project /pipeline project and build+testing + reporting project 

But we have missed most important notification part of team every-time build is completed. 

we are going to setup own smtp server for email sending.
we are going to use docker container based MailDev client.


Part 17 Build trigger with Jenkins 

Build trigger in Jenkins let us to start a job once any specified event occurs.

Part 18 Configure agents in Jenkins 2.0

Jenkins supports the "master/slave" mode where the workload of building projects are delegated to multiple "slave" nodes allowing a single jenkins installation to host a large number of projects or to provide different environments needed for builds/tests.

Different ways starting slave agent.

there are different ways starting a slave agents like

1) Have master launch slave agent via ssh
2) Have master launch slave agent on windows
3) Write your own script to launch Jenkins slaves
4) Launch slave agent visa java web start
5) Launch slave agent headlessly


Part 19 : Blue Ocean and UI/UX improvements in jenkins








Comments

Popular posts from this blog

Search Engine Optimization (SEO) Tricks

6 Key Search Engine Optimization (SEO) tricksStressed and frustrated with your Website's lower rankings on the Search Engines?The tricks and tactics listed below can tremendously change the entire scenario of your website's ranking and rating on Search Engine Results Pages (SERPs) and can take your website to a whole new level, with which increase in relevant traffic on the website is easily observable.http://www.boolment.com The tricks discussed here needs to be implemented in the most desirable way possible. Paginate Your Content: The content on your website is the main facial asset with which you can either impress your audience if the content is paginated well, or you can confuse the hell out of them if the content is unpaginated. So, make sure to arrange everything in a well-ordered manner. Organize CSS For Spiders: Organizing CSS for spiders is a crucial factor that must be considered in order to let the Search Engines know what you are up to and what exactly are you trying…

Android & iOS Application Development For Dummies

App Development ProcessApp Development Process explained in the most simplified way This tutorial will guide all the beginners how an app is developed from scratch and will help in letting the beginners know how the process works.Phase-1 (Conceptualization): Even a concept or an idea starts with an approach to introduce something after acknowledging the inkling of amiss or what's missing in the existing market. Developing the aftermath ideas involves critical questioning and rational thinking towards the wire-framing stage. Phase-2 (Design): After analyzing the idea thoroughly and looking through all possible dimensions, comes the design part, where a feasible layout of the model is planned to move ahead for the further development processes. Phase-3 (Coding): Development process begins with designing a user-friendly UI. Prototypes of the model are prepared with the combined agreement of developers and designers to increase the efficiency and capitalization. The expedience checking r…

Digitization of Restaurant Chains

How Restaurant Businesses Are Transforming With Mobile Apps The Interaction Between Apps and Customers: Customers interact with mobile phones more often than we can imagine and this interaction can be efficiently utilized when it comes to ordering food, which in turn makes it hassle-free for the customers to order food. Just by looking at the online menu on their mobile phones, customers can effortlessly feed themselves with your service and at the same time, your sales graph can jump vertically upwards. While a customer easily gets all information regarding your restaurant, your restaurant gets famous at the same time. In that sense, mobile apps have restructured the way customers and restaurants interact with each other. Business Profits With Mobile Apps:Mobile apps for restaurants benefits them through multiple dimensions. From push notifications to personalized offers, the customer engagement becomes more thrifty with your catering. To explain it with an example, consider the restau…