donderdag 22 augustus 2013

Building the Industrial SQL Connector for Mylyn with Hudson

To get early warning when changes in Eclipse, Mylyn or EclipseLink break the build of Industrial SQL Connector for Mylyn, I have set up a build on my home Hudson CI server. When you want to use this connector you can do the same following the steps below.

Prerequisites

You will need a Hudson CI server set up, follow instructions here. You will also need maven installed from here or use the integrated version.

Create a new Hudson Job

01 createjob

After pressing OK you will see:

02 jobcreated

Configure and test SVN checkout

Enter the anonymous SVN checkout url from EclipseLabs : http://svn.codespot.com/a/eclipselabs.org/industrial-mylyn/trunk/. Also configure the build triggers, now set for 30 minutes past hour on weekdays. Can probably be less, but CI is supposed to be well continuous

03 configuresvn

After saving this configuration, press Build Now

04 testbuild

05 allcheckedout

When it's done, check the Workspace. It should look like this:

06 workspaceview

Configure the Maven/Tycho build and test it.

Next step is to add building the checked out code. Industrial SQL Connector for Mylyn comes preconfigured for a Maven/Tycho build so that is easy. Add the Build Step named Invoke Maven 3

07 addmaven3build

We need some advanced options so click the Advanced button. Most important is that the root pom file is not in the root directory but in com.industrialtsi.mylyn.maven/

08 configuremaven3build

Press Build Now again.

09 testbuildagain

Build success

When all is well you should see this, Finished: SUCCESS

10 testbuildsuccess

Results are all in the Workspace, so a bit hard to find:

11 testbuildresults

Publishing artifacts

You can archive and publish the artifacts produced by Maven by configuring the build.

12 archiveresults

This produces the following Job display:

13 resultspublished

Sunshine!

14 sunshine

dinsdag 20 augustus 2013

Industrial SQL Connector for Mylyn updated for Eclipse 4.3 and Mylyn 3.9.0 (now version 0.9.10)

New activity at Bug 184532: [connector] Generic SQL connector meant it was time for a fresh look at the Industrial SQL connector for Mylyn.

New Kepler Platform Target

I have added a Kepler target platform with latest Mylyn and EclipseLink 2.4.2 for easy configuration Kepler Target I have updated the references In the MANIFEST.MF to point to Mylyn 3.9.0

Connector build with Maven/Tycho

I fixed the Tycho/Maven build so you can quickly get up to speed Tycho/Maven build

Fragment build with Maven/Tycho

In the process I made an interesting discovery about Tycho dependency resolution when compiling fragments. An Eclipse code fragment depends on a host plug-in. The PDE allows the fragment to use all dependencies of the host, even the ones marked optional. When building with Maven/Tycho these dependencies are not resolved. The fix was to add the required JAR to the Extra Classpath Entries of build.properties of the fragment. Extra Classpath Entries

Resources

Code for the Industrial SQL connector for Mylyn is hosted at EclipseLabs.

donderdag 24 januari 2013

Starting Hudson automatically on Mac OSX.

With yesterdays release of Hudson 3.0.0 by the Eclipse Foundation a step forward was taken again in creating an open source toolchain under proper governance. Hudson is an extensible continuous integration platform allowing you to build, inspect and test code whenever you commit changes to your repository. The new release brings a reduction in footprint of 50% so you can also set it up to run on your local machine. After downloading and installing Hudson following the instructions on www.eclipse.org/hudson you that it is easy to start from the terminal using
> java -jar hudson.war

First try: launchd script

But this quickly becomes tiresome, so there must be a better way. On Mac OSX this is launchd, the launch service. Another important thing is that I don't want all the builds to clutter up my home directory so I want to have the HUDSON_HOME direct to somewhere else. Create a directory /usr/local/hudson and move hudson.war into it.
> sudo mkdir /usr/local/hudson
> mv hudson-3.0.0.war /usr/local/hudson/
> cd /usr/local/hudson/
> sudo chgrp admin hudson-3.0.0.war
> ln -s hudson-3.0.0.war hudson.war
I then created a file in /Library/LaunchDaemons named org.hudson-ci.agent.plist with the following contents (skip this step if you're in a hurry):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- Move HUDSON_HOME to /Volumes/yourdisk/hudson_home/ -->
	<key>EnvironmentVariables</key>
	<dict>
		<key>HUDSON_HOME</key>
		<string>/Volumes/yourdisk/hudson_home/</string>
	</dict>
	<key>Label</key>
	<string>org.hudson-ci.agent</string>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
	<key>ProgramArguments</key>
	<array>
	  <string>java</string>
	  <string>-jar</string>
	  <string>/usr/local/hudson/hudson.war</string>
<!-- prevent Hudson from becoming visible in the Finder & Dock -->
	  <string>-Djava.awt.headless=true</string>
	</array>
	<key>StandardErrorPath</key>
	<string>/Library/Logs/hudson-err.log</string>
	<key>StandardOutPath</key>
	<string>/Library/Logs/hudson-out.log</string>
</dict>
</plist>

Trouble!

When I had used this for a couple of days I noticed something strange. All Jobs would suddenly disappear. The reason turned out to be that sometimes during startup the Volume where HUDSON_HOME was now located wasn't available yet. The result is that another directory is created inside /Volumes/ where a new path to HUDSON_HOME is created. Launchd allows for some very clever extra checks like PathState but in the end I settled for something simpler.

Solution

Just delay startup of Hudson for a few seconds.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- Move HUDSON_HOME to /Volumes/yourdisk/hudson_home/ -->
	<key>EnvironmentVariables</key>
	<dict>
		<key>HUDSON_HOME</key>
		<string>/Volumes/yourdisk/hudson_home/</string>
	</dict>
	<key>Label</key>
	<string>org.hudson-ci.agent</string>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
	<dict>
		<key>PathState</key>
		<dict>
			<key>/Volumes/yourdisk/hudson_home/</key>
			<true/>
		</dict>
	</dict>
	<key>ProgramArguments</key>
	<array>
	  <string>/Library/Java/Hudson/start_hudson.sh</string>
	</array>
	<key>StandardErrorPath</key>
	<string>/Library/Logs/hudson-err.log</string>
	<key>StandardOutPath</key>
	<string>/Library/Logs/hudson-out.log</string>
</dict>
</plist>
and the following in the start_hudson.sh script:
#!/bin/tcsh
set hudsonVolume = "/Volumes/yourdisk"
# introduce delay of 120 secs
sleep 120

if (! -e $hudsonVolume ) then
  exit 0
endif
growlnotify -n Hudson -m "Hudson starting..." 
# start it
/usr/bin/java \
  -jar /usr/local/hudson/hudson.war \
  -Djava.awt.headless=true \
  --httpPort=9090
This has been running now for a couple of weeks and now my builds and inspections run automatically.