Continuous Integration (CI) is a development practice where developers integrate code into a shared repository frequently, preferably several times a day. Each integration can then be verified by an automated build and automated tests. While automated testing is not strictly part of CI it is typically implied.
One of the key benefits of integrating regularly is that you can detect errors quickly and locate them more easily. As each change introduced is typically small, pinpointing the specific change that introduced a defect can be done quickly.
In recent years CI has become a best practice for software development and is guided by a set of key principles. Among them are revision control, build automation and automated testing.
“Continuous Integration doesn’t get rid of bugs, but it does make them dramatically easier to find and remove.”
Benefits of CI:
Continuous integration is intended to produce benefits such as:
- Integration bugs are detected early and are easy to track down due to small change sets. This saves both time and money over the lifespan of a project.
- Avoids last-minute chaos at release dates, when everyone tries to check in their slightly incompatible versions
- When unit tests fail or a bug emerges, if developers need to revert the codebase to a bug-free state without debugging, only a small number of changes are lost (because integration happens frequently)
- Constant availability of a “current” build for testing, demo, or release purposes
- Frequent code check-in pushes developers to create modular, less complex code
With continuous automated testing benefits can include:
- Enforces discipline of frequent automated testing
- Immediate feedback on system-wide impact of local changes
- Software metrics generated from automated testing and CI (such as metrics for code coverage, code complexity, and feature completeness) focus developers on developing functional, quality code, and help develop momentum in a team.
Different CI Tools to implement Continuous Integration:
One of the requirements for the implementation of the Continuous Integration is the utilization of the Continuous Integration tools. While there are many Continuous Integration tools out there, there are some that are more widely used. Choosing the right CI tool for your purposes can be a bit bothersome, especially if you want to start using them for the first time, so I hope this list will provide you with the quick and easy preview of the features and possibilities of some of the most used continuous integration tools on the market.
So below are the list of Continuous Integration tools available in market:
Jenkins is an open source CI tool written in Java. It originated as the fork of Hudson when the Oracle bought Sun Microsystems. Jenkins is cross-platform tool and it offers configuration both through GUI interface and console commands.
What makes Jenkins very flexible is the feature extension through plugins. The Jenkins plugin list is very comprehensive and you can easily add your own.
Besides extensibility, Jenkins prides itself on distributing builds and test loads on multiple machines. It is published under MIT license so it is free to use and distribute.
Atlassian is the company focused on providing tools for software development teams, and you might know them by their tools like JIRA and Bitbucket. Bamboo is Atlassian’s CI tool that comes in two separate versions. The cloud and the server.
If you decide to go for the cloud version of Bamboo, Atlassian will host the Bamboo for you and you will need the Amazon EC2 account. If the server is your preferred choice, you will host your own instance of the Bamboo server.
Both versions come with the free trials and the pricing plans are based on the build agent count rather than the users. Being the Atlassian tool, it has native support for JIRA and BitBucket, and you can even import your Jenkins configurations into Bamboo easily.
Travis is an open source service free for all open source projects hosted on the GitHub. Since it is hosted, it does not depend on any platform. It is configured using .travis.yml files which contain the information to do.
It supports a variety of different languages and the build configuration for each of them is well documented. Travis uses the virtual machines to build applications.
If you have a private repository or you need to run more than one job concurrently, there are various monthly subscriptions plans.
Go is the newest Cruise Control incarnation from ThoughtWorks. Excluding the commercial support that ThoughtWorks offers, Go is free of charge. It is available for Windows, Mac, and various Linux distributions.
What makes Go stand out from the crowd is the concept of pipelines which makes the modeling of the complex build workflows easy. It is designed from the scratch to support pipelines and eliminate build process bottlenecks with the parallel execution of the tasks.
GitLab CI is an integral part of the open source Rails project GitLab, which was brought to light by the company GitLab inc. GitLab is hosted on GitLab.com, a free hosted service, and it provides detailed git repository management with features like access control, issue tracking, code reviews, and many more.
GitLab CI is fully integrated with GitLab and it can easily hook projects using the GitLab API. GitLab process builds are written in the Go language and can run on Windows, Linux, OSX, FreeBSD, and Docker. The official Go runner can run multiple jobs concurrently and has inbuilt Docker support.
GitLab CI comes with both the open source GitLab Community Edition, and with the GitLab Enterprise Edition which comes with a 45 day money back guarantee.
Another hosted alternative that comes from the company of the same name. CircleCI currently only supports GitHub and the list of supported languages includes Java, Ruby/Rails, Python, Node.js, PHP, Haskell, and Skala. What separates CircleCI from the other tools is the way they offer services.
The main pricing block for CircleCI is the “container”. One container is free and you can build as many projects on it as you need. Once you start adding more containers (at a fixed price each) you can choose the level of parallelization that suits your needs. There are 5 levels of parallelization (1x, 4x, 8x, 12x and 16x).
So, starting with the 16 containers, you can achieve maximum parallelization of 16x on one build. Or you can run 4 builds on 16 containers with 4x parallelization.
If you haven’t had enough hosted solutions up until now, here is another one. Codeship relies on GitHub and Bitbucket and provides a dose of test parallelization with the ParallelCI feature. It supports Java, PHP, Ruby (Rails), Node.js, Python, and Go, and you can deploy your projects on the services like AWS or Heroku.
The trial includes one concurrent build and one parallel test pipeline, and is limited to 100 builds per month and 5 projects. The pricing comes in several upgrading packages with the option of adding the docker platform for the additional cost of $75 monthly. There is also a custom plan where you can fully customize parameters that suit your team the best.
TeamCity is a mature CI server, coming from the labs of JetBrains. JetBrains has established authority in the software development world, and their tools like WebStorm and Resharper are used by developers worldwide. TeamCity offers all the features in its free version, but it is limited to 20 configurations and 3 build agents.
Out of the box, TeamCity has the support for wide variety of tools and frameworks and since it supports many .NET features out of the box it might be best suited for your .NET project. Despite being Java based solution, TeamCity offers the best .NET support among the tools on this list. It also has a wide variety of publicly available plugins, developed both by JetBrains and third parties.
In our earlier post we have discussed about different CI tools available in market. But Jenkins is widely acceptable as it is Open source and readily available to use. It has sizable nos of plugins which makes it even more powerful. So here in this post we will be discussing about installation of Jenkins.
Open CMD and change directory to the location where the Jenkins.war file is kept.
Enter command “java –jar Jenkins,war” and press enter to start installation.
You can see a message on CMD “Jenkins is fully up and running” which implies completion of installation successfully.
Now navigate to http://localhost:8080 to see the Jenkins Home page.
Configuration and creating new jobs
Once installation is done, navigate to the Jenkins Dashboard (http://localhost:8080 by default) in the browser window.
Click on the New Item link to create a CI job.
Enter Item name and Select Freestyle project and then click on ‘OK’ button.
After Clicking on OK button, Your next screen will be as below. Now Click on Advanced.. Button
After Clicking on Advanced.. Button it will expand with different options as below. Select “Use Custom workspace” and Enter your Project Directory.
Build Triggers Setting:
On the same page if you will scroll down you will find Build Triggers section. Click on “Build periodically” check box. Under Schedule text box you can provide time to execute the build periodically.
Note: Here H 06 * * * means, the build will execute every day 6 AM. You can schedule according to your requirement.
Post-build Actions Setting:
This Section is all about -After execution of Build what action you want to perform.
Here is the list of Action items available that you can select.
Here I selected Email Notification. Means Email will be triggered to given Recipients when build fail.
You can choose multiple Post Build Actions by Clicking Add post-build Action button.
All Major Settings has been done. Now Click on Apply then OK.
Now Click on Manage Jenkins Link
It will redirects with following options. Click on Configure System options
Navigate to JDK section. Click on JDK installations and Enter JDK Name and JAVA_HOME
Navigate to E-mail Notification Section and Click on Advanced.. Enter the Details as below.
Click on Apply then OK.
Congratulations!! You are done with all mandatory Jenkins Settings.
Now Select the Item that you have created. Here I have created MyProject
Click on Buid Now Link to execute the Build.
All the Build execution history will be displayed under Build History Section