Passing Parameters Between Builds in Hudson

In my last post, I talked about setting up Hudson to run nightly benchmarks.  While trying to take that to the next step, and get nightly benchmarks recorded in a graph, I discovered that passing parameters between builds may not be as easy as it originally seemed.  If you’re using the Hudson Parameterized Trigger plugin, that gets you part of the way to passing parameters between builds, but I was left wanting more flexibility than it offered.

I wanted to set environment variables with an Execute Shell step, and then be able to pass them as parameters to the benchmarks build.  I wanted to pass the git commit id and timestamp to the benchmarks build for recording.  The Git SCM Plugin doesn’t provide that information to Hudson.  The Parameterized Trigger plugin is able to handle environment variables that are set by Hudson itself.  However, when trying to set them in the Execute Shell step, it didn’t pick up the newly set environment variables.  At this point I looked through the available options.  I saw that I could set the Parameterized Trigger to read from a parameters file.  I tried writing out a parameters file from the Execute Shell section, and reading it in using the Parameterized Trigger plugin.  Success!

Here are the commands I used to write out the properties file:

echo "COMMIT_ID=$(git rev-parse HEAD)" >
echo "COMMIT_TIME=$(git log -1 --pretty=\"format:%ad\")" >>

In the end, it worked out pretty well.  After these commands are run, a file is created.  The Parameterized Trigger plugin is setup to read, and the information moves on to the next build.

Posted on April 20, 2010 at 11:06 pm by Joe · Permalink
In: Uncategorized · Tagged with: ,

One Response

Subscribe to comments via RSS

  1. […] ago I talked about running nightly benchmarks with Hudson. Then in the previous post I discussed passing parameters between builds in Hudson. Both of these posts are worth reading before trying to setup Hudson with […]

Subscribe to comments via RSS

Leave a Reply