Jenkins


What is Jenkins?
Before going to understand that, what is Jenkins let first understand about the continuous integration.
It is a development practice, which helps the developers to integrate their code into a shared repository several times in a day. Let say a developer check-in some code and then he wanted to verify by an automated build, allowing team to detect problems early. Therefore, by integrating regularly, the developer can detect errors quickly, and locate them more easily.
There are many continuous integration tools like Jenkins, TeamCity, Travis CI, Bamboo, GitLab CI etc.

Jenkins is a continuous integration server or tool which is written in Java that provides Continuous Integration services for software development, which can be started via command line or web application server.
It is used to build and test your software projects continuously making it easier for coders to integrate changes to project and making it easier for testers to obtain fresh build.
Jenkins integrates development life-cycle processes of all kinds, including build, document, test, package, stage, deploy, static analysis and much more.
The core aim of continuous integration is to identify a defect (majorly at integration level) and provide instant feedback so that it can be rectified as soon as possible

Why Jenkins?
Let us take a scenario where some developers are working on an application and the complete source code of the application have to build and then deploy on test server for testing.
è      Developers would have to wait till the complete application is developed for the test results.
è      It can be a high probability that test results might show many bugs. And for the developers it has very tough to locate the bug because they have to check the entire source code of application.
è      The whole process is manual.
Steps to install Jenkins:
 Installing the Jenkin server on Ubuntu:
Jenkins provides Debian/Ubuntu packages which install Jenkins and register Jenkins as start service. See the Install Jenkins on Ubuntu description 
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins

The Linux installation creates a /etc/init.d/jenkins script which starts Jenkins automatically at boot time.


Jenkins stores all the settings, logs and build artifacts in its home directory. The default installation directory is /var/lib/jenkins under Ubuntu.
Using .war file to start Jenkins:
Step 1- Download the Jenkins .war file from https://wiki.jenkins.io/display/JENKINS/Meet+Jenkins
Step 2- Now copy the ‘jenkins.war’ file in a folder. Ex C:\Jenkins\jenkins.war
Step 3- Open command prompt and goto the Jenkins folder, run the below command
Java –jar Jenkins.war
Step 4- Once Jenkins has started , the URL - 'localhost:8080' will be accessable.

Note- Jenkins can also be installed as a window service. For more details use this url https://wiki.jenkins.io/display/JENKINS/Installing+Jenkins+as+a+Windows+service

1- Configure Jenkins:


1.1-  Create a new user:

Step: 1 – Select Manage Jenkins from the Jenkins UI and then click on Configure Global Security.
 
 


Step: 2- Select Enable security flag.



To create a new user, the first thing is require to set the security realm. The easiest way to do this is to have Jenkins with our own database. To achieve this, select the option Jenkins own user database. Also, ensure that Allow users to sign up checkbox is also checked. Save the configuration.


Now a link Sign up will be available. Click on the same and fill the form to sign up. Once successful, log in with the account created.
 

 

From this page also we can create user. For that click on Create User

1.2-Secure Jenkins:
Step 1 – Select Manage Jenkins from the Jenkins UI and then click on Configure Global Security.
 

 

Step 2- Select Enable security flag. 

 

 
 


1.3- Generate ssh key for Jenkins user:
To access a private Git repo, let say at Github, you need to generate an ssh key-pair.
Use the below command to create a SSH key :
sudo -u jenkins ssh-keygen
The public key must be uploaded to the service you are using, e.g., Github.


2 - Jenkins Management:

 

 
                                                           Click on NEXT

No comments:

Post a Comment