CruiseControl.NET MultipleTrigger failure when using with AND operator
During my work with Cruise Control .NET I was required to created dependency between projects in a way that I have the following hierarchy
The steps and explanations are:
- Compile the setup of the project
- Install the setup (that contain few types of roles) on 3 servers in parallel
- After above 3 projects finished run test program (integration test) on system.
I thought it would be very simple because I know that the current implementation of Cruise Control .NET has MultipleTrigger class already implemented that allows creating trigger on several project with OR / AND operator.
After doing the ccnet.config configuration I tested it and found that project "Entire system" didn't start after all three project were completed successfully (actually its was random with more occasions that it didn't work).
After investigation I realized that there is a basic implementation problem because even when using AND operator the triggers were iterated one by one BUT if one of the triggers didn't create Integration Request than the multiple Trigger would return NULL and stop the iteration which in our case it would mean the the internal project triggers would even run one time so actually they don't have initial status (limitation).
I fixed this issue and thought it would fix everything but than I continued and found that although I fire the triggers one by one because I use Project Trigger if it is fire and returns Integration Request the next call would return NULL if the threshold (internal interval Trigger) wasn't met (to make things simpler this means that unless I have a situation that all triggers return Integration Request at once the response would be NULL --> nothing would be built)
My fix now had to be in a way that all the trigger would be fired at the same bulk and actually cause the get project status action so I decided to set the internal triggers to be 1 second each and added new internal interval trigger that will be used as threshold and set it to 10 seconds.
So now I have MultipleTrigger2 class that actually fire the internal triggers at once every 10 seconds (should be configurable)
At the end I also added a new flag that will enable me to trigger the internal trigger on first run rather than wait 10 seconds.
* important to say that because I am using Project Trigger as the internal triggers and it has a limitation that it doesn't have the initial state until first run (I think I am going to add state persistent to Cruise Control .NET implementation)
Because I will patch the original Cruise Control .NET I decided to add it to my CCE project.
Needless to say that everything seems to work :) (This post should save you more than 5 hours of HARD work)