Passing information to and from different plugins in

by Michael Henstock 8. January 2013 11:56

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

From the ITrigger.Fire() method, 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, 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;


C# |