Jenkins vs Travis - Comparing Two Popular CI Tools
Continuous integration is now common practice, but not all CI tools are created equally. To be more precise, certain CI tools are better suited for certain types of projects. This guide will compare two of the most popular CI tools, Jenkins and Travis CI, to help you decide which one is preferable in specific situations.
What is continuous integration?
Continuous integration, or CI, is the practice of integrating individual developers' code and making builds several times each day. The concept was introduced over two decades ago to avoid "integration hell," or the inevitable onslaught of problems that occur if integration is put off until the end of a project. Besides saving programmers from headaches, CI also saves developers time and money. Addressing individual problems as they arise is far more efficient than putting everything off until the last minute and trying to figure out what went wrong.
Programmers used to be solely responsible for integrating their own code, but now CI tools running on a server handle integration automatically. Such tools can be set up to build at scheduled intervals or as new code enters the repository. Test scripts are then automatically run to make sure everything behaves as it should. After that, builds can be easily deployed on a testing server and made available for demo or release. Some continuous integration tools even automatically generate documentation to assist with quality control and release management.
How do CI servers work?
Continuous integration servers can be configured to integrate every ten minutes, once a day or every time a developer interacts with the server. Whenever changes are committed to the repository, the CI server runs tests against the master code. If the CI tool identifies problems during integration, it can stop the build before everything breaks and generate a report pointing out specific problems for developers to fix. Ongoing integration and testing helps teams better gauge their progress on meeting deadlines and thus avoid last-minute delays. The goal of continuous integration is to ensure that all of the code is stable and ready to be deployed at all times.
Of course, different development teams have different needs, which is why there are dozens of CI tools to choose from today. There is rarely a one-size-fits-all solution in software development. The best CI tool for open source projects might not be ideal for enterprise software. For example, let's compare two CI tools intended for different types of jobs: Jenkins vs Travis CI.
What is Jenkins?
Jenkins is a self-contained, Java-based CI tool. Jenkins CI is open source, and the software offers a lot of flexibility in terms of when and how frequently integration occurs. Developers can also specify conditions for customized builds. Jenkins is supported by a massive plugin archive, so developers can alter how the software looks and operates to their liking. For example, the Jenkins Pipeline suite of plugins comes with tools that let developers model simple-to-complex delivery pipelines as code using the Pipeline DSL. There are also plugins that extend functionality for things like authentication and alerts. If you want to run Jenkins in collaboration with Kubernetes and Docker, there are also plugins for that.
While the software's high level of customizability is seen as a benefit to many, Jenkins can take a while to configure to your liking. Unlike tools like Travis CI that are ready to use out-of-the-box, Jenkins can require hours or even days of set up time depending on your needs.
- Available for Windows, Mac OS X, and other Unix-like systems
- Supported by hundreds of plugins available via the Jenkins Update Center
- Plugin architecture allows developers to add their own extensions
- Integrates with most tools in the continuous integration and delivery toolchain
- Includes various job modes
- Lets you launch builds with various conditions
- Compatible with Libvirt, Kubernetes, Docker and many other programs
- Boasts a RESTful API that is ideal for cloud-based web services
- Free to download and use
- Practically endless options for customization
- An ever-growing collection of plugins
- Requires a dedicated server, which may entail an extra expense
- Can take a while to configure and customize
What is Travis CI?
Travis CI is another CI tool that's free to download, but unlike Jenkins, it also comes with free hosting. Therefore, developers don't need to provide their own dedicated server. While Travis CI can be used for open source projects at no cost, developers must purchase an enterprise plan for private projects.
Since the Travis CI server resides on the cloud, it's easy to test projects in any environment, device or operating system. Such testing can be performed synchronously on Linux and macOS machines. Another benefit of the hosted environment is that the Travis CI community handles all server maintenance and updates. With Jenkins, those responsibilities are left to the development team.
Of course, teams working on highly-sensitive projects may be wary of sharing everything with a third party, so many large corporations and government agencies would rather run continuous integration on their own servers so that they have complete control.
Travis CI supports Docker and dozens of languages, but it pales in comparison to Jenkins when it comes to options for customization. Travis CI also lacks the immense archive of plugins that Jenkins boasts. Consequently, Travis CI offers less functionality, but it's also much easier to configure; you can have Travis CI set up and running within minutes rather than hours or days.
Another selling point of Travis CI is the build matrix feature, which allows you to accelerate the testing process by breaking it into parts. For example, you can split unit tests and integration tests into separate build jobs that run parallel to take advantage of your account's full build capacity. For more information about the build matrix option, see the official Travis CI docs.
Travis CI features:
- Comes with free cloud-based hosting that requires no maintenance or administration
- Capable of running tests on Linux and Mac OS X simultaneously
Travis CI pros:
- Lightweight and easy to set up
- Free for open source projects
- No dedicated server needed
- Build matrix feature
Travis CI cons:
- Enterprise plans come with a cost
- Limited options for customization
A side by side comparison
From a cost perspective, both Jenkins and Travis CI are free to download and use for open source projects, but Jenkins requires developers to run and maintain their own dedicated server, so that could be considered an extra expense. If you can't or don't want to configure Jenkins on your own server, there are cloud hosting services specifically for Jenkins. If you need help setting up a Jenkins server, there are plenty of tutorials online to help you perform any type of set up you need.
Travis CI offers hosting for free, but you'll have to pay for an enterprise plan if your project is private. Travis CI enterprise plans start at $129 per month and go up based on the level of support you require. Fortunately, they don't charge per project, so if you have multiple projects that need hosting, then you can really get your money's worth. Travis CI's maintenance-free hosting is a major plus since they take care of server updates and the like. All developers must do is maintain a config file. If you host Jenkins on your own server, then you are of course responsible for maintaining it. Fortunately, Jenkins itself requires little maintenance, and it comes with a built-in GUI tool to facilitate easy updates.
If you want a CI tool that you can quickly set up and begin using right away, then Travis CI won't disappoint. It takes very little effort to get started; just create a config file and start integrating. Jenkins, on the other hand, requires extensive setup, so you'll be disappointed if you were hoping to just dive right in. How long Jenkins takes to configure will depend on the complexity of your project and the level of customization you desire.
As far as performance goes, Jenkins and Travis CI are pretty evenly matched. Which one will work best for you project depends on your preferences. If you're looking for a CI tool with seemingly unlimited customizability, and you have the time to set it up, then Jenkins will certainly meet your expectations. If you're working on an open source project, Travis CI may be the better fit since hosting is free and requires minimal configuration. If you're developing a private enterprise project, and you already have a server for hosting, then Jenkins may be preferable. Since they are free to download, you have nothing to lose by experimenting with both and performing your own Jenkins vs Travis CI comparison; you may end up using both tools for different jobs.
When it comes to comparing Jenkins vs Travis CI, there is no absolute winner. Travis CI is ideal for open source projects that require testing in multiple environments, and Jenkins is better suited for larger projects that require a high degree of customization.
Therefore, professional developers can benefit from familiarizing themselves with both tools. If you're working on an open source project with a small team, Travis CI is probably a good choice since it's free and easy to set up; however, if you find yourself working for a large company, you're more likely to work with tools like Jenkins.