Software development is a journey. It starts with planning, analysis, design, development, testing, deployment, and maintenance. Software developers need various tools to use in this journey.
GitLab CI and Jenkins are among the biggest names in the continuous integration and delivery (CI/CD) niche. CI/CD is a set of processes automating software development.
This GitLab vs. Jenkins article will define each tool, explain how each works and compare their key features.
What is GitLab CI?
GitLab Continuous Integration and Delivery is a DevOps tool that automates the steps required to build, test and deploy your code to your production environment.
GitLab CI has two parts; Continous Integration (CI) and Continous Delivery/Deployment (CD).
Continuous Integration is tasked with automating all builds. This feature also provides feedback through code review and automates security and quality tests for your code. Finally, CI creates a release package to deploy to your production environment.
The Continuous Deployment bit of the GitLab CI automatically provisions infrastructure and manages ticketing, infrastructure changes, and release versioning. CD offers an environment for progressive code deployment and allows the verification and monitoring of all the changes made. This feature also allows users to roll back changes whenever necessary.
When the two features are combined, you can automate the entire software development lifecycle (SDLC) with minimal manual intervention.
In a nutshell, GitLab CI is used to;
- Store and manage code
- Automate the CI/CD pipeline
- Track issues
- Secure code
- Collaboration
Pros of using GitLab CI
- Increased Speed: You no longer have to go through manual processes such as building, testing, and deploying code when you use GitLab CI.
- Improved code quality: With GitLab CI, you can capture bugs and errors in your code before they move to production.
- Secure: GitLab CI has various security features such as vulnerability scanning, secret management, and code scanning to reduce hacking threats.
- Flexible: You can customize GitLab CI to meet the needs of your development team. You can use this tool with major languages and frameworks.
- Automated testing: You do not have to run tests manually, as you can write scripts to write and execute tests automatically.
What is Jenkins?
Jenkins is an extensible automation server. This open-source tool helps users to manage and build Continuous Integration and Continuous Delivery (CI/CD) pipelines. Jenkins is a favorite tool for DevOps and software engineers as it helps improve the software quality, reliability, and speed of delivery.
Jenkins runs a series of ‘jobs’ or steps in a pipeline. A job consists of several steps that are executed in a sequence. A step in Jenkins can be a build, test, deployment, or any other task that can be automated in the software development lifecycle.
The uses of Jenkins can be summarised as follows;
- Continuous Integration
- Continuous delivery
- Automated testing
- Monitoring and reporting
- Code scanning
- Job scheduling
Pros of using Jenkins
- Scalable: You can use Jenkins with both small and big applications.
- Easy configuration: Jenkins has a straightforward configuration process supported by enough resources.
- Large community: Jenkins has been around for almost two decades and has attracted many followers.
- A variety of plugins: You can improve the functionality of Jenkins using its wide variety of plugins.
- Allows parallel job execution: With Jenkins, you can perform different tasks simultaneously, saving time.
Similarities of GitLab CI and Jenkins
- Both support continuous Integration and continuous delivery.
- Both are open-source tools.
- Both have a large community and following.
- Both support a variety of languages and frameworks
- Both automate various tasks in the software development lifecycle
- Both have a large ecosystem of plugins and extensions
GitLab CI vs. Jenkins: A comparison of features
Feature | GitLab CI | Jenkins |
Open-source | Yes | Yes |
Language support | Many languages | Many languages |
Pricing | Most of the features are available in the free plan. The tool also has paid plans with more features. | A newer platform; was created in 2014. |
Maturity | A newer platform; created in 2014. | Jenkins was launched as Hudson but forked and renamed Jenkins in 2011. |
Ease of use | Easy to use | It can be complicated for beginners. |
Hosting | Internal and external | Internal and external |
Prerequisites | Node.JS, Git, Ruby, Go | Java Runtime Environment |
GitLab CI Vs. Jenkins: Detailed comparison
Even though GitLab and Jenkins share similarities, the two have distinct differences that affect how they manage the CI/CD process. These are some of the major areas;
Architecture
Jenkins employs a master-worker architecture to manage builds.
- Jenkins master schedules job builds and distributes them to workers for actual execution. This feature also monitors the state of the workers, collects and aggregates all the build results in the web dashboard.
- Jenkins worker is a Java executable running on a remote machine. Also known as build agent, this feature listens for all requests from the master and executes them. You can have up to 100+ nodes and add or remove workers as you see fit.
GitLab CI is part of GitLab, a web-based interface for managing repositories, merge requests, and so much more. GitLab CI has various components;
- GitLab CI/CD tool allows you to manage builds.
- GitLab Runners execute all the CI jobs. This lightweight process can run in the cloud or on your machine.
- CI/CD Pipeline Configurations are defined in the
.gitlab-ci.yml
. This file defines all the jobs, stages, and steps in the pipeline.
Plugins
Jenkins has over 1800 community-contributed plugins. These plugins cover different areas, such as building, deploying, and automating projects. Users can customize their CI/CD pipelines and extend Jenkins’ functionality.
Developers can create custom plugins with the help of Jenkins’ extensive documentation. They can also build plugins and add them to Jenkins’ directory. Jenkins has a large and active community that helps build plugins.
GitLab CI allows you to connect/ integrate with external services for enhanced functionality. Its plugins/ extension library is smaller compared to Jenkins but growing. As GitLab CI is part of GitLab, it comes with many built-in features.
Users can customize/ configure their workflows using the .gitlab-ci.yml
file. You can specify all the jobs, stages, and steps.
Pipelines
Jenkins allows you to use both declarative and scripted pipeline syntax. You can use any of the two approaches with web UI or a Jenkinsfile. The latter is the most preferred. You can store its pipelines as Jenkinsfiles within the repository that stores the source code. The platform comes with a built-in web-based GUI where you can monitor and visualize the executions.
GitLab CI has a .gitlab-ci.yml
that defines all the pipelines. This YML-based configuration file is stored in the project’s root directory. The gitlab-ci.yml
is known for its simple syntax with a range of commands and predefined keywords covering the most common CI/CD tasks. GitLab CI integrates with other GitLab features, allowing source-code management, issue tracking, code reviews, merge requests, and so much more.
How to install Jenkins
Before installing Jenkins on your PC, you need a Java Runtime Environment (JRE). Download Java from the official website, depending on your operating system. I will be using Ubuntu to demonstrate the installation process.
If you are using another operating system, check out our article on Installing Jenkins and follow the listed steps.
For Ubuntu, follow these steps;
Step 1: Check that JRE is installed. Run this command:
java -version
If it is installed, you will have something like this:
I have installed version “17.0.6”, but you can have a higher version.
Step 2: Import the GPG key to your system using this command;
curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee \
/usr/share/keyrings/jenkins-keyring.asc > /dev/null
Step 3: Add Jenkins’ software repository using this command;
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
Step 4: Update your system using this command:
sudo apt update
Step 5: Install Jenkins using this command:
sudo apt install jenkins -y
Step 6: Check if Jenkins is installed using this command:
sudo systemctl status jenkins
If installed, you will see something similar to this:
Hit ctrl+z on your keyboard to exit and move to the next step.
Step 7: Modify the firewall and Jenkins on your system. Use this command:
sudo ufw allow 8080
Step 8: Check the status
sudo ufw status
Step 9: If the status reads “Inactive” in the previous step, enable it using this command:
sudo ufw enable
Step 10: Open Jenkins in the browser by typing this in your browser;
http://localhost:8080
Step 11: Obtain “Administrator password” by running this command:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Step 12: Unlock Jenkins
Copy the password displayed on your terminal, paste on the “Administrator password” dialog box you open in step ten, and hit ‘Continue’.
The new window will prompt you to Install plugins. Since you don’t need many plugins at the moment, you can pick the default ones and move to the next step
Step 13: Create your account, ‘save and continue’.
Step 14: Set up instant configuration and start using Jenkins
How to install GitLab CI
GitLab CI is part of GitLab. To get GitLab CI, you must first install GitLab Runner, the agent that runs all the jobs before sending them to GitLab.
I will be using Ubuntu to demonstrate the process. If you have another operating system, check the official documentation. For Ubuntu, follow these steps;
Step 1: Update and configure your system;
sudo apt-get update
sudo apt-get install -y curl openssh-server ca-certificates tzdata perl
You can configure an email solution to send updates or skip this step.
Step 2: Add GitLab package repository
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
Step 3: Configure your GitLab account.
There exist different options for hosting GitLab. Follow the instructions depending on your choice.
Step 4: Browse the hostname and log in. Click this command on your terminal to obtain your password;
/etc/gitlab/initial_root_password
Optional: Set communication preferences to receive product updates and news from GitLab.
Limitations of Jenkins
- Jenkins can be complex to set up for large projects.
- If not well configured, Jenkins can be vulnerable to security attacks.
- It might be hard to scale large projects while using Jenkins.
- Jenkins can consume a lot of resources when running numerous concurrent builds.
Limitations of Gitlab CI
- GitLab CI can be complex for large projects.
- Dependent on GitLab.
- Scalability is an issue for large projects.
- The plugin ecosystem is not big as compared to Jenkins.
Author’s opinion
Both GitLab CI and Jenkins are fantastic tools in the software development lifecycle. I will go for Jenkins if I want a more mature platform and complete control over customization. On the other hand, I will go for GitLab CI for its user interface and need to benefit from GitLab integration.
We now believe you can tell the differences between GitLab CI and Jenkins. Even though the two tools are designed to perform similar functions, they differ in features and how they achieve their functions. The choice between the two will depend on the nature of the project you have, your skills, taste, and preferences.
You may now look at these Jenkins hosting platforms.