Passing information to and from different plugins in CruiseControl.net

by Michael Henstock 8. January 2013 11:56

Passing a value from a custom trigger plugin to another plugin inside CruiseControl.net is quite simple.

From the ITrigger.Fire() method, CruiseControl.net expects an IntegrationRequest to be returned. In this object we can add the information that we wish to pass to our next plugin. To do this, we add our information to the BuildValues Dictionary<string, string> like this:
var request = new IntegrationRequest(buildCondition, "New integration request", null);
request.BuildValues.Add("my_info", "test info");
When a build is successfully started in CruiseControl.net, these values are parsed into the Parameters NameValuePair list on the IIntegrationResult object, that is either passed to your objects through the standard interface. This can be accessed like this:
var labelParameter = integrationResult.Parameters.SingleOrDefault(x => x.Name == "my_info");
if (labelParameter != null)
    return labelParameter.Value;

Tags:

C# | CruiseControl.net