David Roberts
David Roberts

Reputation: 477

Can I get Hudson to built just once during a single day? (but not at a specific time)

At the moment I'm using the Hudson CI to build a medium sized project every 5 minutes on SCM change. I'd like to push the use of it out a bit further, and get it doing proper daily/nightly builds (at the moment the CI isn't doing anything with the products, its there for unit testing only)

However, the problem is the CI server isn't run on a dedicated box - it's actually a machine that's up for most of the day, but does eventually turn off (it isn't on for a predictable start->end time span either)

So I would just stick @daily into Hudson, but from what I can tell, this builds at midnight, when there's a very high chance the machine won't even be on.

Is there any way I can get hudson to perform a single build every day, but not at a specific time? e.g. Can I somehow trigger it as soon as hudson starts, or something along those lines?

Thanks

Upvotes: 2

Views: 1012

Answers (3)

aku
aku

Reputation: 195

The Hudson plugin repository has a plugin for starting builds when Hudson is started up: http://wiki.hudson-ci.org/display/HUDSON/Startup+Trigger

Install the plugin through the "Manage Hudson" page, and enable the trigger on each job you want to build on start up.

If you're rebooting the machine every day, it might provide what you want.

Upvotes: 0

Simon Groenewolt
Simon Groenewolt

Reputation: 10665

Do you use ANT to build your classes? In that case you could implement the 'once a day' functionality inside your ant build file.

Write the date to a file on build, and only build if today is not that date. (Using tstamp and condition tasks)

In this scenario Hudson would still check every 5 minutes, and ant would just skip the build process if it determines the build for today has already been made.

I'm guessing you can create a similar solution using other build tools.

Upvotes: 0

You can use the CLI plugin to externally control the Hudson process.

You can then script whatever you need around it, like putting it in a "run every hour" cron script in where you keep track of the last invocation of the build, so you can determine when you want to launch the build again.

Upvotes: 1

Related Questions