Introduction to Jenkins

Sadil Chamishka
3 min readOct 4, 2019

--

Java has been platform-independent as JDK/JRE provides platform dependant JVMs. Jenkins is developed using Java, then it has become platform-independent.

Jenkins provides continues integration and continues deployment. In a simple sense, for a code commit corresponding build will be triggered and the corresponding artifact will be deployed.

Let’s install and setup the Jenkins server.

  1. Download Jenkins war file and keep in a folder.
  2. Execution of this command inside the folder will create a password to log as the admin user of the Jenkins server.
java -jar jenkins.war

3. Log in to the server through port 8080 as it is the default port.

All configurations files can be found inside .jenkins folder in the home directory.

In the previous method, the Jenkins server will start in interactive mode. if you exit from terminal server will stop. We can start it as background process as follows.

nohup java -jar jenkins.war &

Otherwise, you can install Jenkins in this manner (I used this)

sudo apt install jenkins
sudo service jenkins start

This command will start the Jenkins server. You can change the default port of the server by modifying the configuration files.

vi /etc/default/jenkins

Change the HTTP port.

Let’s Create a build pipeline.

First, log into the server by creating username passwords and install plugins.

You will be prompted as this after the successful setup.

If you have not installed plugins at the beginning, you will have to install plugins manually like this. For this project, I will need git and maven plugins to be installed.

From the dashboard go to Manage Jenkins. Then go to manage plugins and install the plugins you need. (This is optional)

Go to New Item, set a name and select Free style project.

Then you will be promoted to create the build pipeline for this project. Let’s first focus on the Source Code Management section.

This is the URL for my sample web app hosted on GitHub. I have set to build from the master branch.

Here you can provide every 5 minutes Jenkin server will check the repository, if a change has occurred in the master branch, then a build job will be triggered.

Here you can provide build details. That means you can configure how to build. As it was a maven project, clean and install goal was setup.

You will have to configure maven previously as follows. you will have to install maven in your local machine. By going to Manage Jenkins and selecting Global Tool Configuration, you configure as follows.

Now the pipeline is set up. you can manually start a build job or can add a commit to the master branch, then build job will be triggered in 5 minutes.

--

--

Sadil Chamishka
Sadil Chamishka

Written by Sadil Chamishka

Associate Technical Lead @ WSO2 IAM TEAM

No responses yet