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
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
- Version Control System.
- Requirements management system.
- Project management system
- automated build management system
- Testing and release management system.
- 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
- Java (latest is good)
- Jenkins war file
- Support tools
- Maven
- Nunit
- Nuget
- 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
- Git
- Nuget
- 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)
- 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
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
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
Thanks to share such a great article on software testing, developing. I will be glad to share this blog with my friends, those who are making a Best Construction Project Management Software. This blog will be helpful to them for software project.
ReplyDeleteReally a great post. Appreciate the effort in educating us. We are also same service provides in Noida.
ReplyDeleteSEO Company Noida
SEO Services Noida
SEO Services India
This comment has been removed by the author.
ReplyDeleteit is great post software solutions is a custom software development and IT-Services. We can provide consulting and software testing. Kuncham company is offering speciality Corporate TrainingSoftware Development
ReplyDeleteI was a little bit impressed, when I have learnt, that JavaScript is used in this server. I believe, that this information will be valuable for people, who are working in a sphere of programming.
ReplyDelete