问题
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?
回答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.
回答2:
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.
来源:https://stackoverflow.com/questions/34178482/how-do-i-trigger-a-cruisecontrol-build-remotely