In this article we will see Brief Introduction On Jenkins.
What is Jenkins?
- Jenkins is a self-contained, open source automation server which can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software.
- Jenkins, originally called Hudson, is an open source Continuous Integration tool written in Java.
- Jenkins is a widely used application around the world that has around 300k installations and growing day by day.
- It is a server-based application and requires a web server like Apache Tomcat.
- Jenkins is a powerful application that allows continuous integration and continuous delivery of projects, regardless of the platform you are working on.
- It is a free source that can handle any kind of build or continuous integration.
- You can integrate Jenkins with a number of testing and deployment technologies.
History of Jenkins
- Kohsuke Kawaguchi, who is a Java developer, working at SUN Microsystems, was tired of building the code and fixing errors repetitively.
- In 2004, he created an automation server called Hudson that automates build and test task.
- In 2011, Oracle who owned Sun Microsystems had a dispute with Hudson open source community, so they forked Hudson and renamed it as Jenkins.
- Both Hudson and Jenkins continued to operate independently. But in short span of time, Jenkins acquired a lot of contributors and projects while Hudson remained with only 32 projects.
- Then with time, Jenkins became more popular, and Hudson is not maintained anymore.
What is Continuous integration (CI)
CI is the process that allows you to build and test automatically.
It also helps ensure that software components work together.
What is Continuous delivery (CD)
CD is the software development process of deploying all code changes in a build to the testing or staging environment.
Picking up where continuous integration ends, CD makes it possible to release builds to the production environment when needed.
- CI/CD is a path for delivering a unit of change that starts from development to delivery.
- It helps you automate steps in your software delivery process.
- A CI/CD pipeline usually consists of the following discrete steps: commit, build, automate tests and deploy.
- Whenever developers write code,We integrate all that code of all developers at the point of time and we build,test and deliver/deploy to the client.
- This process is called CI & CD.
- Jenkins will help us to achieve CI & CD.
- Instead of doing night builds,build as and when commit occurs by integrating all code in SCM tool,build,test and checking the quality of that code is called continuous Integration.
- So,In a day,there will be so many integrations,builds,tests and deliveries/deployments.
- So,Bugs will be reported fast and get rectified fast.So development happens very fast.
- We attach GIT,Maven,Selenium & Artifactory plugin’s to Jenkins.
- Once Developers put the code in GIT,Jenkins pull that code & send to Maven for build.
- Once build is done.Jenkins pull that built code and send to Selenium for testing.
- Once testing is done,then Jenkins will pull that code and send to artifactory as per requirement and so on….
- We can also deploy with Jenkins.
Ways of Continuous Integration
- Write scripts
- Use tool like Jenkins
Benefits of Jenkins
- Detect bugs as soon as possible.
- If you want you can stop SDLC process at any stage.
- Maintains history (Logs) for reference.
Combine all code written by developers till some point of the time.
Compile the code and make a small executable package.
Test in all environments whether application is working properly or not.
Stored in a artifactory so that in future we may use/deliver again.
Handing the product to client.
Installing the product in client’s machines.
Why only Jenkins?
- It has so many plug-in’s.
- You can write your own plug-in.
- You can use community plug-ins.
- Jenkins is not just a tool.
- It is a frame work.i.e.You can do what ever you want.All you need is plug-ins.
- We can attach slaves(nodes) to Jenkins master.
- It will instructs others(salves) to do job.
- If slaves not available, .Jenkins it self does the job.
- Running some scripts regularly.
- Can create labels (Can restrict where the project has to run).
- Jenkins follows Master-Slave architecture to manage distributed builds.
- In this architecture, slave and master communicate through TCP/IP protocol.
Jenkins architecture has two components:
Jenkins Master/Server and Jenkins Slave/Node/Build Server
The main server of Jenkins is the Jenkins Master. It is a web dashboard which is nothing but powered from a war file. By default it runs on 8080 port. With the help of Dashboard, we can configure the jobs/projects but the build takes place in Nodes/Slave. By default one node (slave) is configured and running in Jenkins server. We can add more nodes using IP address, user name and password using the ssh, jnlp or webstart methods.The server’s job or master’s job is to handle:
Scheduling build jobs.Dispatching builds to the nodes/slaves for the actual execution.Monitor the nodes/slaves (possibly taking them online and offline as required).Recording and presenting the build results.
A Master/Server instance of Jenkins can also execute build jobs directly.
Jenkins slave is used to execute the build jobs dispatched by the master.
We can configure a project to always run on a particular slave machine, or particular type of slave machine, or simple let the Jenkins to pick the next available slave/node.As we know Jenkins is developed using Java is platform independent thus Jenkins Master/Servers and Slave/nodes can be configured in any servers including Linux, Windows, and Mac.
Jenkins offers many attractive features for developers:
Jenkins is a platform-agnostic, self-contained Java-based program, ready to run with packages for Windows, Mac OS, and Unix-like operating systems.
Jenkins is easily set up and configured using its web interface, featuring error checks and a built-in help function.
There are hundreds of plugins available in the Update Center, integrating with every tool in the CI and CD tool chain.
Jenkins can be extended by means of its plugin architecture, providing nearly endless possibilities for what it can do.
Jenkins can easily distribute work across multiple machines for faster builds, tests, and deployments across multiple platforms.
Free Open Source
Jenkins is an open source resource backed by heavy community support.
Advantages of Jenkins
- It is an open source tool.
- It is free of cost.
It does not require additional installations or components. Means it is easy to install.
- Easily configurable.
- It supports 1000 or more plugins to ease your work. If a plugin does not exist, you can write the script for it and share with community.
It is built in java and hence it is portable.
- It is platform independent. It is available for all platforms and different operating systems. Like OS X, Windows or Linux.
- Easy support, since it open source and widely used.
- Jenkins also supports cloud based architecture so that we can deploy Jenkins in cloud based platforms.
Disadvantages of Jenkins
- Its interface is out dated and not user friendly compared to current user interface trends.
- Not easy to maintain it because it runs on a server and requires some skills as server administrator to monitor its activity.
- CI regularly breaks due to some small setting changes. CI will be paused and therefore requires some developer’s team attention.