Jenkins Configuration
Continuous integration:
1)
Continuous integration is a process in which all development work is integrated
as early as possible. The resulting artifacts are automatically
2) created and tested. This process should identify errors
as very early in the process.
3)
Jenkins is one open
source tool to perform continuous integration and build automation. The basic
functionality of Jenkins is to execute a
defined
4)
list of test cases. The trigger for this execution
can be time. For example, every 6 hours or at specified day and time.
1) Installation of Jenkins :
1) Download the Jenkins .war file
2) Navigate to below link and download latest Jenkins
war file.
b.
3) Open command prompt and use below command to
start Jenkins
a.
4) By default Jenkins will be launched in 8080 port.
5) for the first time, it asks for the secured
password and registration.
6) Copy the Admin password and enter the
password like below shown in the image and Click on continue.
1) You
can get the initial admin password from the above mentioned path of your disk.
2)
Install all the Plugins specified.
Click on "Select plugins to install"
1)
Select the "All" and click Install
2)
This Plugins installation will take around 10-15minutes.
3)
Once the plugins are installed, it will redirect to the following page.
4)
Provide the required details, Take a note of the details used and click
on Save , Finish.
5) Click on Start using Jenkins .
2) Creating Project In Jenkins :
1) Login with the registered details.
URL: http://localhost:8080/
2) Click on New Item
3) Provide Project name and click on Freestyle Project>>OK
4) The following are the major sections in the project
4.1 General
4.2 Build
4.3 Build Triggers
4.4 Post-build Actions
3) Build:
3.1 Click on Add Build Step and select "Execute Window Batch
Command"
3.2 In the command section,
specify the Bat file trigger path, Click on Apply And Save
3.3 Click on Build Now, and the results can be viewed in the build
history
3.4 If the build is passed, the color will be blue else it will be in
red color.
3.5 Click on the build number and select console output to see the
result.
4) Build Triggers:
4.1 In the Build triggers section select Build Periodically for
scheduling the
executions.
4.2 Here We have to provide cron patterns.
executions.
4.2 Here We have to provide cron patterns.
4.3 Specify the respective cron patters, click on save and apply.
4.4 Cron Patterns to schedule Execution:
Monday-1
Tuesday-2
Wednesday-3
Thursday-4
Friday-5
Saturday-6
Sunday-7,0
5) Executing Project From Jenkins
·
Create a bat file for the selected project and place in the project
location.
Bat File:
·
A batch file is a kind of text file, in which we will specify the
commands that we use in command prompt.
·
When this file is trigerred, The commands inside the file will get
executed one by one sequentially.
·
Bat Files can be useful to configure the project with Jenkins .
·
Bat file code for normal java class.
javac Class1.java
java Class1
·
Bat file code for Eclipse java project.
set
classpath=lib\*;src;
javac
src\pc1\Class1.java
java pc1.Class1
·
1) Login with the registered details.
·
2) URL: http://localhost:8080/
·
3) Add New Freestyle Project
·
4) Add Build Step and specify bat file path
·
5) Add Build Trigger if required
·
6) Add Post Build Action if required.
·
7) Click on Save
·
8) Click on Build Now.
·
9) On Execution, the email will be sent to the specified recipients.
The following are the sample projects which can be used.
Java Class:
Java Project:
TMasters Framework:
6) Git to Jenkins Integration
with Maven Project:
1)
Navigate to our GitHub
Repository and select the our repository project URL.
My URL is: "https://github.com/VeeraMohanSelenium/Testing"
2)
Login with the registered details.
3)
URL: http://localhost:8080/
4)
Click on New Item
5)
Enter The Job Name(Project Name) and click on maven project then clock
on ok button.
6)
Navigate to Source code Management and click on Git Radio button.
7)
Enter the GitHub Repository URL into Repository URL of Jenkins Textbox and click on Add button
8)
Click on Jenkins under Add
button.
9)
Enter the valid admin UserName and Password and click on Add button.
10)
Navigate to Build and enter the maven execution commends
11)
Clock on Apply and Save Buttons.
12)
Click on Build Now.
No comments:
Post a Comment