tags:

views:

24

answers:

1

When creating projects in Hudson, I usually have to check a few CVS repositories and add a few files (e.g. properties) to build the project. This only has to be done once (or each time the project is checked out).

Currently I do this by manually copying the files with regular Linux commands after I have created the project and failed ant once. Since the files are usually the same except for a few path names, it would be useful to create the files with some kind of automatic process (e.g. Velocity), but I don't know how to run a task only when the project is checked out for the first time.

Maybe there is a plugin for this, but I didn't find any in the list.

+1  A: 

First, if at all possible, you should add the files to what your Hudson project checks out from source control (since you can check out multiple modules/directories).

Otherwise, I recommend adding the setup steps to you normal build process. Even though in the normal case the setup is only done once (you can check for existence before copying), it's good to make it explicit that you depend on certain files copied from well-known locations. Eliminating manual steps makes builds easier to reproduce and can inform you about where there are dependencies on the environment.

Once the setup is automated, it's straight forward to add a build step at the beginning that calls a script to perform the pre-build procedure. (Or you can call the pre-build script directly from your standard build command, no extra step needed in Hudson.)

When creating a new project, you can copy from an existing one. So, once you have a pre-build script set up, you can create a template project with that as the first build step. Then when you create a new project, copy from your template. We have templates for different projects with our standard repository setup and build steps customized to the platform. That also makes it easy to setup branch builds.

Dave Bacher
I think somebody suggested to me using an ant target for the initialization, but I haven't tried that before. I will try to do that.
Alex Lehmann

related questions