user223728
user223728

Reputation:

Configure hudson to build multiple branches

I use an ant file to build a java project in mercurial through hudson. The mailnine has a hudson job running just fine. Recently a new branch was created and pushed to the server by commnd line:


hg branch newbranch
hg commit
hg push -f


The mainine does not contain these changes and still builds fine. I have set up a new job with the same setting as mainline (in fact copied mainline job in hudson), and specified the newbranch.

However, the newbranch job builds code identical to mainline. If I commandline clone the repository and switch to the newbranch everything looks as expected. This seems to be a hudson configuration glitch unless my merqurial skills are off course.

I have also tried to set up the job from sratch with settings identical to mainline with the addition of the newbranch specification without any luck.

What am I missing? Anyone any ideas?

Upvotes: 1

Views: 2034

Answers (2)

Ry4an Brase
Ry4an Brase

Reputation: 78330

Try putting the branch in the URL to clone like:

http://server/path/to/repo#newbranch

or

ssh://user@server//path/to/repo#newbranch

You can see the full syntax for branch-in-repo-url using hg help urls

URL Paths

Valid URLs are of the form:

  local/filesystem/path[#revision]
  file://local/filesystem/path[#revision]
  http://[user[:pass]@]host[:port]/[path][#revision]
  https://[user[:pass]@]host[:port]/[path][#revision]
  ssh://[user[:pass]@]host[:port]/[path][#revision]

Paths in the local filesystem can either point to Mercurial repositories
or to bundle files (as created by 'hg bundle' or 'hg incoming --bundle').

An optional identifier after # indicates a particular branch, tag, or
changeset to use from the remote repository. See also 'hg help revisions'.

Upvotes: 5

Michael Donohue
Michael Donohue

Reputation: 11876

One issue with cloning a job is that the 'cloned' job is created as soon as you hit the clone button. While you are still configuring the cloned job, it may hit a build trigger like an SCM polling event that causes it to kick off before you have fully configured it.

I believe this was fixed in later versions of Hudson, but cannot find the changelog entry for job cloning. The same issue existed for cloning a slave configuration, and the problem was fixed in Hudson 1.319.

Upvotes: 0

Related Questions