Back to Top

Continuous Integration with Jenkins and GitLab

Updated 2 April 2018

What is continuous integration (CI)?
Continuous integration (CI) is a software engineering practice in which changes made in code are immediately tested and reported. Each check-in is then verified by an automated build, allowing teams to detect problems early. Hence by integrating regularly, we can detect errors quickly and can locate them easily.

CI software tools can be used to automate testing and build a document trail. Jenkins is the by far the most popular open source continuous integration tool. It’s a Java-based automation server that has CI/CD plugins to support building, deploying, and automation.

GitLab’s Jenkins integration allows us to trigger a Jenkins build when a code is pushed to a repository, or when a merge request is created. Now let’s look how can we integrate Jenkins and Gitlab.

GitLab Configuration

1. Create build user and access token at Gitlab

To create a user and access token go to Profile Settings -> Access Tokens. Over there create a new user named “jenkins-user” or any name of your choice. Now create a personal access token and save.

Copy the access token and save somewhere, because it won’t be visible for the second time.

Start your headless eCommerce
Find out More


Jenkins Configuration

1. Add Gitlab credentials to Jenkins

In the Jenkins’s System credentials add a new credential of the type GitLab API token. Paste the API token copied earlier in the ‘API Token’ field and save them.

2. Configure Jenkins server

Before configuring the Jenkins server make sure if Jenkins GitLab Plugin and Jenkins Git Plugin are installed. To configure the Jenkins server go to Manage Jenkins -> Configure System and move to the ‘GitLab’ section. Enter the GitLab server URL in the ‘GitLab host URL’ field and select the added Gitlab credentials from the ‘credentials’ drop-drown.

3. Configure Jenkins project

The Connection between Jenkins and GitLab is setup,now we need to create a job or configure an existing job. Configuring a Jenkins project will be clear by the following screen-shoots



Webhook Configuration(Gitlab)

Create a new GitLab project or choose an existing one. Then, go to Project-> Integrations -> Jenkins CI. Enter the Jenkins project URL in the given ‘URL’ field, select the trigger events from the list and save. A new web-hook will be added accordingly.


We are all done to integrate Jenkins and gitlab. If you push a commit to the repository,you should see the Jenkins job start running.

For any doubts feel free to comment, suggestions/improvements are highly appreciated.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


  • Arun Kumar
  • Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home

    Table of Content