Normally a 'build' label is generated when you check something out of source control, a continuous increasing number, a date based number, ... but always something related to a source control. Luckily CCNet already made abstraction of this, making it easy to create labels with custom logic. Since this logic is very dependant on our setup, I wrote it as a plugin, adding it to the core off CCNet is not a good choice for this.
Writing a labeler plugin is not more difficult than writing a publisher or so, it means implementing ThoughtWorks.CruiseControl.Core.ILabeller
A bit of of background on our deployment setup :
° whenever a program passes QA, it gets zipped
format is version_number_program name
° it is placed in a folder hierarchy so programs belonging to the same 'family' stand together (all finance programs are together)
° we always install the latest version, (should the need arise that we need to install a previous version, we just delete the newer zip files from the folder)
So suppose I do an install of bookkeeping, the labeler must just get the zip file with the highest number from the finance/bookkeeping folder. One caveat : 1_2_0_10 is higher than 1_2_0_3 so plain sorting on the file names is a no-go. Anyway, here's the code of the labeler :
The programToInstall contains which program is being installed (duh)
so in the ccnet.config I fill this with finance/bookkeeping which is the same argument as I pass to the install program.
Here's the code for the sorting of the zip files :
Basically, I format the numeric parts to length 5 and use the string sorting on it.
So 1_0_3_0 becomes 00001_00000_00003_00000 for the sort procedure.