Tuesday, June 05, 2007

Creating Nightly build, coverage, JUNIT testcases using LUNT BUILD



Official Website for Luntbuild is http://luntbuild.javaforge.com/

Prerequisites

1) Install Tomcat
2) Install Apache Ant
3) Add jar files for Antelope Apps and Antelope Tasks or any other required jar files of tasks to /lib
4) Start Tomcat
5) Install all dependent softwares for the project


Luntbuild Installation

1) Execute installation jar file

  • java -jar luntbuild-x.y.z-installer.jar

2) Specify luntbuild installation directory

  • d:\ProgramFiles\luntbuild

3) Provide following parameters for customizing web application

Session time out [min]: 30
Luntbuild Account password: luntbuild (luntbuild is admin account for Luntbuild web application)
Path to war deploy dir: E:\tomcat\apache-tomcat-5.5.20\apache-tomcat-5.5.20\webapps (tomcat webapps dir)

4) Provide database configuration information

5) Provide information for LDAP authorization (if required) (Not required in out case)

Configuring Luntbuild

1) Login to Luntbuild web GUI (http://localhost:8080/luntbuild/) using default username and password (luntbuild, luntbuild (or what ever password you have given while installation))

Note: The web GUI will automatically login as anonymous user, hence first you need to logout

2) Go to Users tab and create necessary users

3) Go to Projects tab

4) Create new project - Click on Icon which is bellow Logout in top right side of the page to add new project

5) Fill the following details for creating new project

Name: Name of the project

Description: Nightly Build

Project admins select the users who should be assigned the role of 'project admin'.

Project builders select the users who should be assigned the role of 'project builders'.

Project viewers select the users who should be assigned the role of 'project viewers'.

Notification methods : Email (You can select other methods also)

Notification users select the users who will get notified for the builds of this project.

Variables nightlyVersionIterator=1
releaseVersionIterator=1

Log level verbose

6) After filling necessary details click on save button to save new project

7) Now got to VCS adaptors tab and click on icon bellow logout in top right side of the page to add new Version Control System for the project

8) Fill the following details for the VCS Adaptors

Version Control System: Dynamic Clearcase

View tag: luntbuild_myproject

Clearcase view stgloc name

Explicit path for view storage For Windows machine share some directory on the machine where you want to create a view storage for luntbuild
and provide the shared directory location with view file name as follows:

\\mypc\sharedDir\viewname.vws

Config spec Provide clear case config spec for the project
Note:
1) Here you can copy & paste the config specification of your existing view
2) For windows machine remove the directory name where the View is mapped and give only relative path in config spec.

Modification detection config

Options for mkview command

Path for cleartool executable \bin

clearcase_home = D:\atria\ClearCase or C:\Program Files\Rational\ClearCase
Note: Only provide the path up to where cleartool executable is stored and do not include the cleartool.exe in the path
and do not specify like this D:\atria\ClearCase\bin\cleartool.exe

History format parameters

MVFS Path : M:

Project path:

Quiet period : 5

9) Click on the save button after filling necessary details to save the VCS configuration

10) Now go to Builders tab to create the builder for the project

11) Click on the icon bellow Logout at top right side of the page to add new Builder to the project

12 ) Fill the following details for the builder

builder type: Ant Builder

Name: nightlybuild_myproject

Command to run Ant: E:\apache-ant-1.7.0\bin\ant.bat

Build script path:

Build targets: main

Build properties:

artifactsDir="${build.artifactsDir}"
junitHtmlReportDir="${build.junitHtmlReportDir}"
coverageHtmlReportDir="${build.publishDir}/coverage_html_report"
properties.files="file name containing properties"
clearcase.viewtag="luntbuild_myproject"
luntbuild.clearcase.vob.prefix=""

Environment variables: JAVA_HOME=C:\Program Files\Java\jdk1.5.0_09
ANT_HOME=E:\apache-ant-1.7.0
ANT_OPTS=-Xmx512m

Build success condition result==0 and logContainsLine("BUILD SUCCESSFUL")

13) After filling necessary details click on the save button to save the Builders details

14) Then go to Schedules tab and click on icon bellow Logout to add new Schedule for the project

15) Fill the following details for the schedule

Name: Schedule_myproject

Description:

Next build version nightlybuild-${#currentDay=system.(year+"-"+month+"-"+dayOfMonth),#lastDay=project.var["day"].setValue(#currentDay),#dayIterator=project.var["dayIterator"].intValue,#currentDay}.${project.var["dayIterator"]}

Work directory

Trigger type cron

Cron expression: 0 0 6 * * ?

Build necessary condition: alwaysIfFailed or vcsModified or dependencyNewer

Associated builders : nightlybuild_myproject

Associated post-builders:

Build type: clean

Post-build strategy: do not post-build

Label strategy: do not label

Notify strategy : notify always

Schedules the current schedule
depends on:

Dependency triggering strategy: do not trigger any dependent schedules

Build cleanup strategy: keep build by days 7

16) After filling all necessary details click on the save button to save the schedule

17) You can also configure Login mapping of luntbuild users with the VCS login
for that go to "Login mapping" tab and click on the icon bellow Logout to create new VCS login mapping entry

For Manually building the project

1) Now go to Home > Select Builds tab > click on the Icon which specify the to trigger the build to trigger the build manualy

2) Fill the following details to trigger the build

Build necessary condition

Build as version

Build type

Post-build strategy

Label strategy

Notify strategy

Dependent triggering strategy

When to build Select one the following
Now start building now
After start building after specified minutes
At start building at specified time in hh:mm format

3) Click on the save to save the building details for the project

View the Build status:

1) Go to home > select Builds tab
here you can view all the projects and their current build status

2) You can click on the link in the "Schedule" column for the project to see the schedule details of the project

3) You can click on the link in the "Last Build" column to view the success or failure details of last build of the project

Here you can find build log, revision log and artifacts for the project

Some troubleshooting tips:

1) While adding new VCS adaptors
a) Use new "view tag" which is not being used
For Example, luntbuild

b) Do not specify any thing for "Clearcase view stgloc name"

c) Use shared location on the local machine for "Explicit View path"
For example,\\mypc\luntbuildShared\luntbuild_view.vws

d) While working on windows machine in config spec specify all the path relatively without giving mapped directory name on Unix machine

For Example,

Instead of giving paths in config specs as follows
core projects
element /mydir/myproject/abc/xyz

give paths as follows (i.e. do not use /cntdb at beginning)
core projects
element /myproject/abc/xyz

2) While configuring Builders

a) Give the proper location as per for Command to run Ant (Exact location where ant.bat is stored)

b) Give complete path for "Build script path"

c) Specify following things correctly in "Environment variables"

JAVA_HOME=C:\Program Files\Java\jdk1.5.0_09
ANT_HOME=E:\apache-ant-1.7.0
ANT_OPTS=-Xmx512m

3) If luntbuild is giving the following error while building the project

Error occurred during initialization of VM

Could not reserve enough space for object heap

Could not create the Java virtual machine.

Ant builder failed: build success condition not met!

For the above error you need to increase heap size of the JVM as follows:

a) Go to Home > Projects > Builders

b) Edit the existing Builder

c) In Environment variables" which is ANT_OPTS=-Xmx512m
you can use ANT_OPTS=-Xmx1024m or higher as per the need

Share |

No comments yet

Topics

 
Embed Wave to Blogger