Sie sind auf Seite 1von 11

Introduction

 Jenkins is an open-source, continuous integration tool developed


by Hudson lab.
 It is cross-platform and can be used on Windows, Linux, Mac OS
environments.
 Jenkins is written in Java.
 Jenkin’s usage is to monitor any job which can be SVN checkout
or any application states.
 Jenkin’s used to automate the built of your projects at a
scheduled time or when a trigger is raised or when the user requests it.
 The automated, continuous build can help a lot in increasing the
productivity and reducing conflicts.
 We can able to send Email notifications to related recipients
when a build is unstable.
Downloading and Installing of Jenkins
1. Go to http://jenkins-ci.org/ and download correct package for
your OS.
2. Navigate to jenkins.war location
3. Type “cmd” in the url bar then you will get command prompt
4. Type “ java -jar Jenkins.war “ in command prompt and press
enter

5.
Wait for the message Jenkins fully up and running
Don’t close the window. This is the jenkins server that should always run in the back ground
6. Once installation is done, open any browser navigate to the
Jenkins Dashboard Enter url as “http://localhost:8080” by default .
8.Copy password from required given location and paste it in admin
password.
C:\Users\sushma\.jenkins\secrets\initialAdminPassword
9.Click on continue and select install suggested plugins
10.After downloading the suggested plugins click on continue as

admin
11.Click ok save and finish
12.Click on “start using Jenkins”
13.When you open url next time (http://localhost:8080) it will ask
username and password because you continue as Admin
UserName is “ Admin”
And Password from the following location
C:\Users\kiran\.jenkins\secrets\initialAdminPassword

Install maven plugins


1. Navigate to Jenkins Dashboard (Home page) click on Manage
Plugins in the left corner
Click on Available
Enter name Maven in Filter (search box in top right corner )
Select all check boxes maven related plugins
Click Install without restart
JDK , MAVEN Configuration:
2. Navigate to Jenkins Dashboard (Home page) click on Manage Jenkins. In
the right side corner click on Global Tool Configuration
Navigate to JDK section on the page, click on “ Add JDK ”
Enter JDK name as “JDk”
JDK: Uncheck “install automatically” to get Java_Home field.
Enter JAVA_HOME AS: Path of JDK in your Program files(up to bin)
3. Navigate to maven section click on Add Maven

Maven Uncheck “install automatically” to get Maven_Home field.


Give Name & Maven Home path here. MAVEN name is: MAVEN
MAVEN_HOME: path of maven where do u save (up to bin)

Now click on “save” & “apply” button

Setup Build
Create Jenkins Project:
1. Go to the Jenkins dashboard and Click on New Item

2. In the next screen, enter the Item name, for example HMS.
Choose the MAVEN PROJECT and click OK

3. It will be redirected to configuration page where you can


specify the details of the job
4.

To run job at required time we can schedule date and time. If we need run run instantly we need
to go to project in Jenkins and click on Build Now

5. Once saved, you can click on the Build Now option and build is
scheduled, it will run.
The Build history section shows that a build is in progress.
6. The build is completed, a status of the build will show if the build
was successful or not. Click on the #1 in the Build history to bring up
the details of the build -> Console Output link to see the details of the
build

Email Notification Configuration:


Provide the below details for Email Notification:
Navigate to Jenkins dash board click on the link “ Manage Jenkins “ In
right side panel
click on configure System Option In next Page Navigate to the email
notification Section.
Click on advanced button and set the values as follows: Here you give
senders Email.
SMTP SERVER: SMTPgmail.com
Select the check box use SMTP Authentication
Username: sushma@gmail.com
Password:
Use SSL select the checkbox
Click on save and finish

Configuring recipients Email:


Opens the Jenkins dashboard. Click on the project name (HMS).

In the project window click on “configure” link . (see below image)


Click on “post build Actions” tab(see in image)

Click the drop down button button and Select ”Email notification” option. In
the recipients text box specify the receivers mail id followed by
==============================================
==============================

click save and apply

How to schedule build periodically in Jenkins?

Jenkins uses Cron format on scheduling. Suppose we are executing some tests repeatedly in
certain interval of time instead of performing that test again and again we schedule the test
execution by specifying the interval .So when the schedule time is reached the test execution will
be done automatically.
...
The steps for schedule jobs in Jenkins:

1. Navigate to Jenkins Dash Board and click on project name

2. click on "Configure" link of the job requirement.

3. scroll down to "Build Triggers" and select

4. Click on the checkBox of Build periodically.

5. Add time schedule in the Schedule field specify CRON pattern as follows,

If you want to schedule your build every 5 minutes, this will do the job : */5 * * * *

If you want to schedule your build every day at 8h00, this will do the job : 0 8 * * *
Click on save button

* */1 * * * -- For every min

0 * * * * --- For every hour

0 */3 * * * -- For every 3 hrs

0 10 * * * -- Every day at 10AM

*****
First star indicates MINUTE Minutes within the hour (0-59)
Second star indicates HOUR The hour of the day (0-23)
Third star indicates DOM The day of the month (1-31)
Fourth star indicates MONTH The month (1-12)
Fifth star indicates DOW The day of the week (0-7) where 0 and 7 are
Sunday.
6 is saturday

5 * * * * will only execute the job every 5min past every hour
*/5 * * * * for every 5mins
So how to build periodically after every 6hrs. Does * */6 * * * will work? –
Spread load evenly by using ‘H/5 * * * *’ rather than ‘*/5 * * * *’ –
friederbluemle Apr 4 '14 at 7:49

By setting the schedule period to 15 13 * * * you tell jenkins to schedule the


build every day of every month of every year at the 15th minute of the 13th
hour of the day.

In addition, @yearly, @annually, @monthly, @weekly, @daily, @midnight, and


@hourly are supported as convenient aliases. These use the hash system for
automatic balancing. For example, @hourly is the same as H * * * * and could
mean at any time during the hour. @midnight actually means some time between
12:00 AM and 2:59 AM.

Das könnte Ihnen auch gefallen