views:

234

answers:

1

We are using Hudson to automate our Android build. I need to incorporate the build number into the version string used in our app. Was wondering if anyone had an example of doing that before I (re?)invent that wheel. Obviously I need to replace a string value in one of our config files.

A: 

Your shell script has access to the environment variable "BUILD_NUMBER", for example "153". You could use that in your config file.

You could also consider "BUILD_ID ", which adds time/date info, such as "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss)

To be super-verbose, you could use the "BUILD_TAG" variable, which is a string of "hudson-${JOBNAME}-${BUILD_NUMBER}"

Finally, there is a version number plugin:
http://wiki.hudson-ci.org/display/HUDSON/Version+Number+Plugin

... which gives you a ton of other options.

William Leara