automating builds
Bill Barry
after.fallout at gmail.com
Thu Apr 24 12:54:02 CDT 2008
As I said yesterday, I am building a source control provider for Cruise
Control.NET; I am trying to determine the best way to do it right now.
There is basically 3 functions:
Modification[] GetModifications (from, to)
gets a list of modifications after the starting time, the ending time
can be used as a means to limit and choose which revision will be built
(I don't think I need it here)
void LabelSourceControl(result)
tags the revision which built successfully with a supplied label
void UpdateSource()
actually updates the working copy for the build to proceed
I am thinking that UpdateSource shouldn't touch the server; it should
only execute "hg update" (or "hg update -r branchname" if there is a
branch name). I think there will be a parameter which would cause either
the build to fail if there is more than one head (or one head in the
branch if you set a branch name), or the build to simply use the latest
head in the branch.
So for pseudocode for UpdateSource:
if MultipleHeadsFail
if (hg heads [-r branchname]).count != 1 -> fail
if branch != null
hg update -r branchname
else
hg update
I think LabelSourceControl is going to be fairly simple:
hg tag -r (result.BuildRevision) -m "some message" (result.Label)
hg push
for GetModifications, I am not really sure:
hg pull [-r branchname]
hg log -d >from
--
Looking through the source of the Ruby Cruise Control and Java Cruise
Control, I see that they seem to do:
GetModifications -> hg incoming
UpdateSource -> hg pull -u
label (same)
but I have an objection to this because a push could have occurred
between the GetModifications and UpdateSource and so the version you
build may not be the version you said you would build. Also, they don't
seem to take into account named branches and they will always build Tip
(they don't have an option to fail if there is multiple heads) so a
broken build could get introduced and wouldn't be found until someone
merged.
Does this make sense? Is there a better way?
More information about the Mercurial
mailing list