24th May 2021

CI/CD with Jenkins and Gitlab


Written By, Uditsing Khati


.NET is one of the important frameworks used in the web development services. In this blog, we will try to cover the end-to-end process related to how we integrate Jenkins on our .NET core project. Here we use GitLab as version control. So whenever a developer pushes their code on the master branch at that time Jenkins pipeline will automatically trigger and follow the processes like build, test, publish and deploy.

In this blog, we are not going deep into Jenkins as it is out of the scope for the current blog, but you can find all the details for Jenkins here…


  1. Gitlab Account (If you haven’t a GitLab account then click here… to open the account)
  2. You have to install Jenkins in your machine. (Download Jenkins from here…)

Please follow the following step to configure the Jenkins pipeline.

Step 1

Open Jenkins and click on New Item

Step 2

After clicking on “New Item”, you will be redirected to the “newJob” page then select Freestyle project and enter your project name.
After setting the project name, click “OK” to continue.

Step 3

After clicking “OK”, you will redirect to the “configure” page.
On this configure page you have to set “Source Code Management”. Select “git” and enter your repository link, set credential, and select the specific branch.

Step 4

After completing all the things just apply the created settings and click on save.

Step 5

After completing the “configure” you have to build your project by clicking Build Now button.

Step 6

After building your project you can see all the source code is available under the Workspace folder.

Step 7

As we know we have to set CI/CD for our .NET project. So, that’s why we have to set install .NET SDK and .NET runtime on the server using the below commands. Then only we can use dotnet commands.
In the Build section select “Execute shell”.
The command is below list out

Step 8

After writing the command again click on “Add build step” and select “Execute Shell”.
Path is: Configure > Build > Execute Shell
Now we have to write a command for the building project, run test cases and then after if everything successfully then deployed the project. So, to perform those actions we have to add particular command.
The command is below list out

Step 9

After writing all the commands, we have to build our project. Then
after a successful build, under the workspace folder, we are able to see our build.

Step 10

As we know after the successfully generated build we have to upload our build to our server.
Here we use the FTP service to upload the build to our server.
Integrate FTP server and Deploy publish file automatically on the server.
So, first of all, we have to add FTP plugins to Jenkins.
So, first, select “Manage Jenkins” then after inside that select the “Manage Plugins” tab and write down the plunging name “Publish over FTP
The path is: Manage Jenkins > Manage Plugins > “Install Publish over FTP” Package.



After installing the FTP package, we have to configure our FTP service.
So, first, select “Manage Jenkins” then after inside that select the “Configure System” tab and after that select “Publish over FTP” and write down FTP details.
The path is: Manage Jenkins > Configure System > Publish over FTP (Add FTP server)



After filling-up FTP details save the FTP configuration.

Step 11

Now, we have to set FTP details in our project.
So, for that select project then after select configure and then after select post-build Actions where we have to add FTP details.
The Path is : Dashboard > Project > Configure > Post-build Actions
Select “Send Build artifacts over FTP”


Step 12

Right now, we were doning setting by Jenkins’s side.
Now, we have to integrate GitLab Webhook into our GitLab account. In this blog, we are not able to cover more details about “Webhooks”. To get more details about “Webhooks” click here…
So, integrate Webhook in GitLab please follow the below path.
The path is: Open Gitlab > Project > Setting > Integrations > Jenkins CI




After integrating Webhook successfully, whenever we push code in our repository using webhook our pipeline will trigger automatically on Jenkins.


In this article, we have learned how to implement CI\CD with Jenkins using the GitLab account. I hope the steps and snippets in the blog will help you to understand & implement CI\CD with your project.

Thank you 🙂 for taking the time to read this article.
I hope this will help you 🤗.

Written By,

.Net developer at Yudiz Solutions Pvt. Ltd