Part 1:
1. Download the war from the below location for jenkins. (http://jenkins-ci.org/)
2. place the jenkins war in the tomcat webapps location
3. start the tomcat startup script.
4. once tomcat is up. click the url in the browser http://localhost:8080/jenkins.
5. The jenkins page will be displayed.
Part 2: configuring the jenkins for job.
1. click manage jenkins link in the left.
I got two messages displayed in the screen, one was related to UTF-8, to fix this i have change the server.xml of tomcat to include the URIEncoding="UTF-8" in the <connector tag>
<Connector connectionTimeout="20000" port="8082" URIEncoding="UTF-8" protocol="HTTP/1.1" redirectPort="8444"/>
2. Configure system.
jdk - java installation
i. click the jdk, remove the default installation and set the java home path where the java is installed.
ANT - installation
ii. click the Ant, and select a name and provide the path of the ant home here.
3. Since we are going integrate with the Git we need to install the plugin.
We need internet access to do it.
If we don't have internet access we can use the to download the .hpi file.
we need :
1. git-client.hpi
2. git.hpi and
3. scm-api.hpi
The plugins can be downloaded at "https://updates.jenkins-ci.org/download/plugins/"
To install the plugin, click Manage Plugins > Advanced tab > under the Upload Plugin section just upload the downloaded hpi's.
Note git.hpi has dependencies with the scm-api.hpi. if git.hpi is installed first we will display the below message.
ava.io.IOException: Failed to dynamically deploy this plugin
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1328) at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1126) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:110) at java.lang.Thread.run(Thread.java:745) Caused by: java.io.IOException: Failed to install git plugin at hudson.PluginManager.dynamicLoad(PluginManager.java:474) at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1324) ... 5 more Caused by: java.io.IOException: Dependency scm-api (0.2) doesn't exist at hudson.PluginWrapper.resolvePluginDependencies(PluginWrapper.java:480) at hudson.PluginManager.dynamicLoad(PluginManager.java:464) ... 6 more
To Set up a new Job for continuous integration we should flow the blow steps:
Once the git plugin is installed in the local system.
Click the New Item to set up the project.
give an item name and select freestyle project for all kind of project.
provide the project name
description
select the source code management version as git
we need to set the repository.
download the git (not the git hub),
> create a local repository using the git init command in git bash
> add the necessary folders / projects to the git master branch.
> in my case i used /C/user/thiru/projects/project1/code was the master branch.
> in the repository url, use this link (not this differs where your project is set.
> use the git add command to add the git folder or file
> use git commit -a -m "test to describe about commit" to commit the project.
> there should a be build.xml file. for the project.
Now we need to configure the ANT to deploy the war.
select either the default or the installed ANT form the configured system.
type in the target in the build.xml
if the build.xml file is present within the project directory then select advanced and i the build file input field provide ./projectfoldername/build.xml
- this will be helpful for old project which has built that way.
Once the above configurations are done, click Save.
In case of any error in the configuration we get error message upfront on clicking save.
If every thing works fine.
click the Build now, and you could see the build history.
if there is any build error a Red color icon will be displayed clicking it will display the error details, user details.
Console output in left side menu bar, will display the step by step instruction involved in generating the war or jar. which can be used for debugging.
This is just a initial step, where we didn't use any remote repository or Linus/Unix machine.
The war will be deployed in the directory mentioned in the ant file. But in case of jenkins, the war file will be in C:/user/<username>/.jenkins/job/<project name set in jenkins>/workspace/project_name/... war location.
Next step for improvement, will be moving the war to designated location.
below are few snapshots of build history.
Executing a Windows batch command after build:
Below are the ways to use Window batch script after build is compete in jenkins. use the Build trigger section, with batch command. refer the snapshot below.
Setting up the auto deploy:
Below snap shot also has the post-build Actions section which can be used to auto deploy the war in the tomcat.
If the Add post-build action didn't have the "Deploy war/ear to a container", then we need to install the deploy.hgi plugin.
1. Ensure appropriate permissions are available in $CATALINA_HOME\conf\tomcat-user.xml
<role rolename="manager-gui"/>
<role rolename="admin"/>
<role rolename="manger-script"/>
<role rolename="manger"/>
<user password="password" roles="manager-gui,manager" username="tomcat"/>
if there is any permission issue, the console output during build will provide the error details.
In our web application project we are not using Maven to resolve the jar dependencies.
We use to download the referenced jar and use.
I wanted to check if there is unused jars and the list of dependent and non-dependent jars.
I came across the tattletale.jar open source from JBOSS community, which provides a report on the dependencies analyzing the jars.
Link: http://tattletale.jboss.org/
This can be configured in jenkins using the tattletale.hgi plugin, which can be downloaded from https://wiki.jenkins-ci.org/display/JENKINS/Tattletale+Plugin
1. Install the plugin in jenkins.
2. Configure the tattletale.jar and javassist.jar, which comes with the downloads of the tattletale.zip.
3. Under, Mange Jenkins -> Configure System -> Tattletale plugin section
5. in the After post-build section enable the invoke tattletale option and provide the directory where the reports are generated.
Note when executing the tattletale.jar -jar <input directory> <output directory> will create the reports in the output directory. we will refer that output directory here.
we will be seeing the Tattletale plugin, which will give us the report.
refer the link: https://wiki.jenkins-ci.org/display/JENKINS/Tattletale+Plugin for more information.






No comments:
Post a Comment