Gitab vs Jenkins 2022: Ultimate Comparison
Ultimate comparison and setup tutorial between GitLab and Jenkins.
Join the DZone community and get the full member experience.
Join For FreeGitlab vs Jenkins has been a popular debate among developers for a long time. While most of the coders like Jenkins, developers cast their votes for Gitlab. Both tools come with certain strengths and weaknesses. Without further ado, let’s dive into the ultimate comparison of Gitlab and Jenkins.
Intro to Jenkins
Jenkins is a popular open-source automation tool that enables businesses of all sizes to seamlessly build and manage Continuous Integration and Continuous Delivery (CI/CD) pipelines by allowing you to add multiple programming languages, repositories, and pipelines, Jenkins makes it possible to integrate every type of automation solution.
Before receiving the name we all know today, Jenkins was actually called Hudson. Its creator, Kohsuke Kawaguchi was working in Sun MicroSystems as a software developer. Hudson was the result of a constant struggle that Kohsuke faced when he was creating and breaking builds. To make his work easier, he wanted to see if the build works before committing it to the repository. The outcome was Hudson, an automation tool for Java that allows developers to identify and resolve integration problems early in the development process instead of later when they are more difficult to resolve. Initially, it was written for Sun MicroSystems but it was later offered as open-source for other companies.
When Oracle acquired Sun, it created a dispute related to the management of Hudson. The result was a new fork of Hudson formed by the Hudson open-source community called Jenkins. While both forks existed for some time, Hudson was closed in early 2020. Jenkins joined the Continuous Delivery Foundation (CDF), an open-source foundation and a part of the Linux Foundation that includes companies such as Google.
Intro to Gitlabs
Gitlab is open-source code management and CI/CD tool. It was initially designed to manage code repositories. Later, it was extended to support a complete DevOps platform, providing end-to-end DevOps capabilities. It enables organizations to seamlessly collaborate with members across teams working on all project-related tasks such as project planning, code repository management, monitoring, and security. By allowing administrators to set permission at one time and then access all resources, Gitlab enables them to easily integrate various solutions and work as a team to build better software. It can be termed as a full-fledged tool to manage the complete DevOps ecosystem.
The Gitlab software was created by Valery Sizov and Dmytro Zaporozhets in 2013. The software was written in Ruby, and Go was used to rewrite some parts later on. The current tool involves Ruby on Rails, Go, and Vue.js programming languages. GitLab Inc. was launched in 2014 with San Francisco as its headquarters. Initially, it was free and open-source. In 2013, it was split into two versions; Enterprise and Community Editions. In 2017, the company announced that Gitlab would be offered as an open-source tool under an MIT license. Today, the company operates in 67 countries with 1280 employees.
Gitlab vs Jenkins
Pricing Models
When it comes to pricing models, Jenkins is open-source and accessible to all users. So, you can save significant investment on licensing costs. The only price you’ll need to manage would be the hosting expense of the server in order to update and maintain it.
As mentioned before, Gitlab was initially offered for free and open-source under the MIT license. Currently, the company offers three packages. The first one is the free version that offers 400 CI/CD minutes per month. The premium version charge is $19 per user per month billed annually and offers 10,000 CI/CD minutes per month. It includes additional features such as project management, ops insights, release controls, etc. The Ultimate version costs $99 per user per month and contains 50,000 CI/CD minutes per month. In addition to all the features of the Premium Edition, the Ultimate edition provides you with advanced features such as portfolio management, compliance or value stream management, advanced security controls, and some other extras.
Core Features
Installation
When it comes to installation, Jenkins is an easy tool to set up. All you need is JRE installed on your machine. It supports Windows, Unix, and Mac platforms. You can run it as a java servlet in GlassFish, Apache Tomcat, or any other Java container; it also works with Docker. You just need to download the file and run the normal installation process. Jenkins is self-hosted and available on-premise too. The configuration of the tool is pretty simple. You can easily configure it using the web interface. The upgrade process is also a no-brainer. Extensive documentation is available for every task.
Similar to Jenkins, the Gitlab installation process is pretty straightforward too. However, it only supports Unix-based platforms such as CentOS, Linux, OpenSUSE, RedHat Linux, Debian, Ubuntu, etc. It doesn’t support Mac or Windows platforms. To run Gitlab on these platforms, you need to go through a round-about process.
Updating Gitlab is super simple. You just need to change the docker image, and everything will be automatically refreshed. Another good news is that Gitlab is available as self-hosted and on-premise.
Plugin Support
As for the Gitlab vs Jenkins plugin support, Jenkins offers an extensive bundle of plugins for every type of CI/CD task. There are more than 1700 plugins available for users that can be easily customized. The plugins are regularly updated. You can integrate these plugins with other DevOps tools as well. Jenkins is significantly extensible owing to its huge plugin portfolio. Whether you want to perform a single task of integrating build processes or manage the entire product development lifecycle, Jenkins makes it easy.
When compared with Jenkins, Gitlab plugin support is limited. However, it offers the necessary plugins to support you at every stage of DevOps.
Continuous Integration / Continuous Deployment
Jenkins doesn’t offer a built-in CI feature, but it provides an easy way to set up continuous integration and continuous deployment for various code repositories and languages using pipelines. It allows you to integrate the entire development technology stack to deliver products faster and better.
Gitlab comes with a built-in CI/CD feature that helps you quickly set up CI/CD pipelines. Auto DevOps is another powerful feature of Gitlab that makes software delivery easy, efficient, and automated. It uses predefined default CI/CD templates that scan your code language and automatically build, test, and deploy tasks. It also includes vulnerability testing and secure auditing that proactively scans the project for vulnerabilities, licensing issues, security flaws, etc. Auto DevOps can be applied at the project level, group level, or instance level. Gitlab gets an edge here in the GitLab vs Jenkins battle.
Auto Scaling
Gitlab allows you to configure Auto-scaling for CI runners that will save 90% of EC2 instance costs. This feature can be applied across the repositories at a project or organizational level.
When it comes to Jenkins, the auto-scale option is rather complicated to make changes to the Jenkins architecture workflow. A script is required to install software on Jenkins runners to provide an automated way to register with Jenkins Primary and then disconnect before termination. In addition, it is important to set up and monitor auto-scale triggering events using a tool like CloudWatch.
Technical Support
One of the key reasons for the success of Jenkins is its community support. Right from installation to usage, the Jenkins community is ready to offer support for any type of task. On the other hand, I must mention that while documentation is available, there is no dedicated technical support team.
When it comes to Gitlab, dedicated technical support is offered for paid users 24×5, while for free users, extensive documentation is available, and great support is enhanced by its community.
Parallel Execution
By allowing you to concurrently run multiple builds across multiple virtual machines, Jenkins makes it easy for developers to continuously and quickly test their code. Gitlab also facilitates parallel execution. It clones the job and runs it in parallel in the background.
REST API Support
Jenkins REST API supports XML, Python, and JSON, enabling you to extend its functionality. Gitlab offers a REST API for projects, groups, and standalone ones.
Work Distribution
Jenkins makes it easy for you to perform CI/CD tasks as you can distribute workloads such as builds, tests, and deployments across multiple machines, platforms, and regions. With distributed workloads and parallel execution, it has faster lifecycles with reduced time frames.
Gitlab allows you to configure parallel execution in the YAML file. Based on the availability of runners, it performs similar operations. Gitlab also supports distributed scaling, so you can scale out builds on different devices.
Scenarios To Use Jenkins and Gitlab
Build, test and deploy are the three important components of a software development project. Both Jenkins and Gitlab offer sufficient support to accomplish these tasks. Jenkins is heavily focused on continuous integration. It is open-source and completely free. It comes as self-hosted and on-premise, a good bet for startups and medium-sized businesses that lack the required budget and expert staff. With Jenkins, you can take advantage of costs. It is easy to learn and work with. The web UI allows you to easily manage processes, and orchestrate and automate jobs.
Gitlab outperforms Jenkins when it comes to version control and code collaboration. It enables the user to easily monitor the entire code repository along with all branches. With Jenkins, you can only monitor some branches. When your development teams are spread across multiple geo-locations, Gitlab serves a good purpose. The second consideration is the price. While Jenkins is free, to use all features of Gitlab, you need to have a subscription
In Gitlab, every branch contains the GitLab-ci.yml code which means you can easily modify the workflows. For instance, if you want to run unit tests on one branch and perform functional testing on another branch, you can simply modify the YML configuration for CI/CD steps, and the Runner will perform the job for you.
Nvidia, Goldman Sachs, Siemens, and Thomson Reuters are a few notable companies that use Gitlab.
Step-by-Step Process to Setup Jenkins
Installing Jenkins is pretty simple. Here are the steps to install Jenkins on Windows.
Step 1: Install Java
- To use Jenkins, you need to install Java on your machine. Java SE 16 is the latest standard edition. To download and install Java, visit this link: Java Download
- Choose the Windows version, accept the license terms on the pop-up window and download the JDK file.
- Accept the license agreement to begin the download.
- Double-click the downloaded file to start the installation process.
- Choose the installation folder and click next.
- The installation process begins. After the process is completed, click close.
Step 2: Configure Environment Variables
- To use Java, you need to configure system variables. To do so,
- Right-click on Windows button -> System -> Advanced system settings -> Advanced
- On the next screen, click on environment variables.
- Under the user variable, select Java_Home and enter the Java path:
- C:\Program Files\Java\jdk-16.0.2
- Under System variables, add the java bin folder path.
- C:\Program Files\Java\jdk-16.0.2\bin
Step 3: Download Jenkins
- To download and install Jenkins, visit this link: Jenkins
- Choose Jenkins 2.303 for windows
- Double-click the Jenkins file to install it. The installer wizard will open, click next and choose the destination folder and click next. Then click on Install.
- The installation begins. Choose ‘run service as a local user’, when it prompts for service login credentials.
- Click on finish when done.
Step 4: Configuring Jenkins
Unlocking Jenkins
After the installation is completed, you´ll need to unlock Jenkins. To do so, open a browser window and type the following command:
The unlock Jenkins window appears. On this screen, you need to enter the initial password created by Jenkins in the log files. You can find the initial password at the following path:
C:\Program Files\Jenkins\secrets\initialAdminPassword
Enter the password and click next. Now, Jenkins is unlocked.
Configure Plugins
After unlocking Jenkins, you will be directed to the plugin page. Here, you can choose default plugins or select the plugins you want to install. The wizard will install the required plugins.
Create First Administrator User
The last step in Jenkins configuration is to create an administrator user. Provide the user details and click on ‘ Start using Jenkins.’ Now, you are all set to start using Jenkins.
Step-by-Step Process to Setup Gitlab
Installing Gitlab is pretty simple. Gitlab recommends Linux installation as it is faster, easy to install, easy to update, and offers more features that are not available in other installations. Omnibus is the installer package that comes with all services and tools required to run Gitlab.
Visit this link to download the Gitlab installer for your OS version: GitLab
For instance, if you are using Ubuntu, follow the instructions mentioned in this link: Ubuntu
Gitlab vs Jenkins
Architecture
Jenkins uses a Master-Slave architecture. The core components of this architecture are the Jenkins Server that acts as a Master, the Jenkins Slave machine, and a remote code repository machine. The master controls build operations, checks the code repository, and pulls the code when it detects a commit. Then it distributes this workload to slave machines which will run the builds and tests to generate the reports. A great advantage of the Jenkins architecture is that it allows you to use various builds running on multiple machines and on different platforms simultaneously.
Gitlab architecture comprises two essential components, namely Gitlab CI/CD and Gitlab Runner. The Gitlab CI/CD tool is a web interface that enables you to manage builds. The Gitlab runner executes codes to run your builds. Both tools work together to manage and run builds. Gitlab Runner takes the script from the GitLab-ci.yml file via APIs and runs the script. The good thing with Gitlab is that it works with repositories such as GitHub, BitBucket, etc.
Pipelines
Here is a basic Jenkins pipeline:
- Developers write the code and commit it to a version control system. eg, Git
- The Jenkins server constantly checks the Git repository for commits. When a change is detected, the Jenkins server triggers a build.
- If the build fails, the report is sent to the developer for changes.
- If the build is successful, it is deployed to a test server. e.g.: Selenium server
- When the tests are successfully run, the code is deployed to the production server.
- Reports are generated at every stage, and the developers are updated at every phase.
Here is how Gitlab works:
- Create a structured order of CI/CD jobs in the GitLab-ci.yml configuration file and store this file in the project root directory. The CI/CD pipeline contains four important stages: build, test, staging, and production.
- Install a runner for your project and register it.
- When a config file is pushed to the repository, the runner executes the CI/CD based on the predefined conditions.
- When the script passes all these stages, it is automatically deployed to production.
Pros and cons
The GitLab vs Jenkins debate is an evergreen topic because both tools offer useful features. Jenkins supports multiple languages and offers a large plugin library. The tool comes with an intuitive interface making it easy to perform tasks such as setting up nodes, debugging runners, or deploying code. It is feature-rich and is flexible to use and edit configurations. Being self-hosted, Jenkins gives you more control over workspaces. Credential management is easy.
On the downside, the lack of pipeline-tracking analytics is a concern. Another challenge is configuring plugin integration and setting up the tool which ultimately increases the overhead for this task.
Gitlab is a complete DevOps tool that takes care of all development tasks. Git version control system comes built-in with this tool. Therefore, the integration with other solutions, addressing ticketing, etc., becomes easier.
Business insights are a crucial feature of Gitlab that allows you to gain clear insights into the impact of changes on the product’s performance. User statistics help you to track resource usage and optimize processes. However, this feature is only available for paid users. Another vital feature is issue tracking. With the help of features like thread discussion, labels, Task Lists, etc., you can easily track and assign issues to quickly resolve them. Moreover, you can import issues from JIRA. Merge management helps you to collaborate and version control projects easily.
Gitlab enables parallel execution with phases which makes it easy to scale runners. Adding jobs and managing conflict issues is easy. The project is more secure with the right privacy policies. The tool easily integrates with Docker. Request integration can be easily merged.
On the downside, it increases the complexity and effort as you need to define and upload/download artifacts for each job. The actual merge should happen before you can test a branch’s merged state.
Alternatives to Jenkins vs Gitlab
As the GitLab vs Jenkins battle continues, several other CI tools enter the fray.
Bamboo CI
Bamboo CI is a popular CI/CD server offered by Atlassian. It helps you create different stages of product development to create and deploy quality and bug-free products faster. For instance, you can set up triggers for each commit in a build. It means when a commit is made, it automatically triggers test suites, enabling you to easily catch bugs and resolve issues at the earliest stage. The striking feature of the Bamboo CI server is that it comes from Atlassian, which offers some well-known software development products such as JIRA, BitBucket, FishEye, etc., which makes it easy to integrate with issue tracking and repository tools to seamlessly work on development projects.
CircleCI
CircleCI is a popular CI server that lets you run everything in the cloud, which means you don’t need a dedicated server. It also eliminates maintenance costs. Alternatively, you can also self-host the CI server for better control. Almost 30,000 organizations use CircleCI, and it runs about 1 million tasks every day. It helps you automate parallel execution to deliver quality products faster. It is easy to set up and use. You can store all settings in a single YAML document. Debugging is easy. The UI is intuitive and easy to navigate. Built-in support for Docker workflow is available.
TeamCity
TeamCity is another popular CI server coming from JetBrains. It supports all major platforms such as Windows, Linux, macOS, FreeBSD, Solaris, etc. there is no hosted version, so you’ll have to host the server on-premise. It runs in a Java environment and is easy to install and configure. It can be easily integrated with Visual Studio and other IDEs. Gitlab and Bitbucket server pull requests are supported. With the newest version, 2019.1, native Gitlab integration is added. While it offers a free version, the licensing cost for building agents is around $39 per month.
Conclusion
Gitlab and Jenkins are the two most popular CI/CD tools available in the market due to the features they offer to users. Both the tools were designed to automate CI/CD processes and are separated by just a thin line in the DevOps race. Both tools come with their pros and cons. While Gitlab gets an edge in code collaboration and version control, Jenkins fares well in continuous integration. As such, you cannot rate one tool over the other in the Gitlab vs Jenkins CI/CD battle. While choosing a CI/CD tool, you need to consider your budget, technology stack, project requirements, and in-house proficiency.
Published at DZone with permission of Alfonso Valdes. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments