Continuous Integration(CI) is a process where developers integrate their code at regular intervals. Code is regularly committed to a shared repository and a build is triggered. It is important that when new code is committed, existing functionality does not get broken. And that is ensured by Jenkins.
The Jenkins tool is a popular open source automation software used for the continuous integration and continuous deployment process. It triggers builds and runs functional tests, UI tests, and smoke tests. It can be used for deployment and static analysis as well.
At Srijan, we have used the Jenkins tool in almost every project to smoothen the CI/CD process for smart and quick delivery of the projects. Some of the key areas where Jenkins was the perfect tool to use are :
- Jenkins was used as a gatekeeper for pushing the code to Github repository. Client had put certain checks related to code standards and some smoke tests. So any code that is pushed to github repo has to go through those checks before the code is merged to github.
- Srijan team has scheduled the Jenkins jobs to trigger at the predefined time and send across the report via email and Slack.
- Jenkins job/build was triggered on every pull request (PR) raised by any team member. A pull request is raised by any team member who pushes his code to github repo to get it merged with master branch so that we have a stable code in Master branch.
- Jenkins is very useful in sending reports to the client on daily basis, so we configure the job to run at predefined time. We don’t need to trigger the job manually, instead Jenkins does this for us and itself sends out the reports.
Now that we know what’s possible with Jenkins, let’s take a closer look at what the tool is, and how it works during the development lifecycle.
Basic Features of Jenkins
- It is coded in Java and can be used across operating systems like Windows, Ubuntu, Debian, Mac OS X, Red Hat, FreeBSD, Open BSD, Gentoo, Fedora, CentOS,
- It triggers a build when new code is committed in the Git repository. Once the build is triggered, it shows number of builds that succeeded or failed, time of last build success and failure, and preferably which parts of a pipeline succeeded or failed.
- Jenkins deploys code on the test server(or any desired server) and triggers automated tests.
- It generates test results that can be emailed to concerned teams.
- It is a dominant tool with numerous active installations and users across the world. Therefore there is lot of support within the community.
How Does Jenkins Work
Jenkins can be used for automating the entire CI process. Let us look at how Jenkins works in the software development lifecycle -
- A developer commits code to the source code repository. The Jenkins tool detects the changes that have occurred in the source code repository as it checks the repository at regular intervals.
- If there is a commit, Jenkins will start preparing a new build with the new changes.
- If the build is successful, Jenkins deploys the build in the test server. If the build fails, then the concerned team is notified. It gives a basic report of success and failure of build and the build trend.
- After testing, Jenkins generates feedback. It generates a test report for the development and QA teams indicating the test results.
- It will continue to check for new source code. As a result, the entire CI process is automated, leading to higher efficiency and faster software delivery process.
Advantages of Jenkins
- The Jenkins tool is widely used, and hence has very strong community support. This means help is readily available for all issues and bottlenecks.
- It provides about 1,000 plugins to different applications in the DevOps process. This makes Jenkins quite extensible. The best part is, you can write your own plugin if you do not find one that suits your requirements.
- For example, it can integrate with Version Control Systems like Git and Subversion. It can work with build tools like Maven and Ant. It has plugins to integrate with tools like JIRA and Bugzilla for reporting issues and the builds where these issues are.
- There are constant incremental iterative improvements.
- It is an open source, cross-platform tool.
- Jenkins can generate test reports that can be viewed on the web UI.
- It can deploy directly to production or test environments making the CI process automated.
Disadvantages of Jenkins
- Jenkins is not compliant with Sarbanes Oxley, ITIL, or COBIT which might be required by some clients.
- Jenkins might not be the best tool for .NET projects as there are other tools that provide more features and integration with .NET tools
- It does not support two factor authentication.
A robust CI/CD system needs to provide all functions required for DevOps and also be flexible to run in different environments. All said and done, the Jenkins tool is great for the CI/CD process as it automates most of the tasks of DevOps and has the facility for others to add plugins as per requirements.
You can also check out our posts on working with Behat, and Selenium, and our webinar on how to manage QA tasks in an agile project. Hope you find them insightful.