Setting Up Continuous Integration with Jenkins

Setting Up Continuous Integration with Jenkins

- 4 mins

What is Jenkins?

Jenkins is an open-source automation tool written in Java with plugins built for Continuous Integration purposes. Jenkins is used to build and test your software projects continuously making it easier for developers to integrate changes to the project, and making it easier for users to obtain a fresh build. It also allows you to continuously deliver your software by integrating with a large number of testing and deployment technologies.


Setting Up Continuous Integration with Jenkins

With this exercise We will try to do;

Set Up Jenkins with Docker

You need to install or set up Docker before this exercise so We will continue Jenkins image pulling and setting up with a container also with the exoesing with the port from Docker host. You can use any Jenkins version for setting up and I will share a git repository for source code. You will be running a Jenkins container on your Docker host by using the Jenkins image with version 2.263.1-slim. Use the following commands to clone the devops-repo directory and launch the Jenkins container.

After the git clone the repo with your VM you can reach the source files for using Docker Compose and you can follow the commands for running Jenkins container.

You can reach with that link: DevOps Repository

cd devops-repo/setup

Inside the devops-repo/setup directory is the docker-compose.yml and the Dockerfile that we will be working with. The Jenkins container image is the 2.263.1-slim version.

docker-compose build docker-compose up -d

Jenkins1

Yes! you can reach the Jenkins container from your local host (localhost:8080) now. You need to pass Password cridential page so for that you should fetch the initialAdminPassword use the following command:

Jenkins6

and paste it into the Jenkins UI to unlock. In the next step, choose ‘Install suggested plugins’ to configure the default plugins automatically. You can select Install suggested plugins then You will wait for setting up.

Jenkins2

Jenkins need to seeting up some configurations just follow the the steps and wait for being ready. You will the page of admin user creation.

Jenkins3

You can create an admin user for managing your Jenkins. When you want to reach to Jenkins You will use your admin user cridentials.

Jenkins7

Creating Your First Jenkins Job

After setting up Jenkins, it’s now time to create your first Jenkins job and run it.You will create a Jenkins job to build the voting app that you are about to fork. Visit example-voting-app on Github and fork the repository onto your git account.

Once you fork the repository, go to Jenkins, top of the page, and click on Create a Job or New Item. Choose the Freestyle project with the name of job-01 and click OK to configure your job. You will get the job configuration page where you can choose the following options.

Steps:

Jenkins11

Jenkins12

Jenkins13

Jenkins14

Jenkins15

TIP: If it all goes well, try to break the job to understand what would happen if the job fails. Fix it to continue. Hint -> open the configuration file and replace the sleep 10 command with exit

Jenkins17

Yes You created your first Jenkins Job…

For more informations you can follow —-> info


Guneycan Sanli

Guneycan Sanli

A person who like learning, music, travelling and sports.

comments powered by Disqus