0

I have a CruiseControl.net (v1.8.4.1) server that runs builds based on a trigger that checks for changes in Git. I would like to be able to initiate a parameterized build remotely, by giving the parameters to a URL. Something like "http://cruisecontrol.local/api/build?job=PreCommitBuild&project=widgets&branch=feature/story123".

The end goal is to have a review system such as that built into Gerrit or Stash be able to initiate a build for a specific branch, by posting some parameters to the CruiseControl server with a web API call.

Is this possible, and if so, how?

mhvelplund
  • 2,099
  • 3
  • 22
  • 38

2 Answers2

1

You could be to use a UrlTrigger which monitors a file on disk, it would need to be exposed via http (iis?), with a Last-Modified header. Iis should be able to do this for you natively.

E.g. http://aserver/triggers/project1.txt

Then get your other tool to amend the file (on disk) in order to trigger the build.

This doesn't support build parameters though.

Otherwise you'll be into the realms of writing a .net remoting client for the api.

edit

As the options above do not cover the passing of parameters to the build/integration as originally asked the following maybe your only option - creating a connection to cruise control and triggering the build programmatically.

See an earlier question: CruiseControl.net Remoting - ForceBuild with reason which shows the method for invoking the build.

The link in this article is the important piece which shows how this can be achieved.

Community
  • 1
  • 1
Simon Laing
  • 1,194
  • 7
  • 18
  • Turns out the post has been removed, see https://web.archive.org/web/20090516002426/http://csut017.wordpress.com/2009/01/02/passing-dynamic-parameters-part-1-the-server/ – Simon Laing Dec 10 '15 at 18:17
0

After tinkering with this for a bit, I wound up getting the code for the Remote assembly from GitHub. The client code works fine, but the server's exposed API (my server at least) seems to be prone to unexpected null reference exceptions.

mhvelplund
  • 2,099
  • 3
  • 22
  • 38
  • 1
    I'm presuming you mean null-reference exceptions? I've never had these issues, are you certain the server/client assemblies are the exact same version? A discrepancy in the versions could cause such issues – Simon Laing Dec 31 '15 at 12:55
  • @SimonLaing: I'm running a 1.8.4 server and using the Remote assembly from the master branch in [Git](https://github.com/ccnet/CruiseControl.NET). According to [cruisecontrolnet.org](http://www.cruisecontrolnet.org) the latest version is 1.8.5 so there might be a version conflict. Unfortunately the Git repo doesn't have tags corresponding to either version so I'm not sure :) Upgrading the server is not an option at the moment. – mhvelplund Jan 05 '16 at 08:03
  • I found the 1.8.4 source zip at http://sourceforge.net/projects/ccnet/files/CruiseControl.NET%20Releases/CruiseControl.NET%201.8.4/ ... I guess I could try to compile that and see if the error goes away. – mhvelplund Jan 05 '16 at 08:08
  • Discussion of the API problems continued in http://stackoverflow.com/q/34510108/511976 – mhvelplund Jan 05 '16 at 09:42