Question

On one of our projects we have a simple CI build on checkin, and another build to test creation of the setup kits fired using a "Finish Build" trigger upon successful completion of the CI Build.

If multiple developers check in at the same time, we can get 1. 2 successive CI Builds, then 2. 1 Setup kit build which includes both check-ins, and then 3. Another setup kit build which includes no changes at all from the previous setup kit build. This build is therefore not required.

Obviously this has been kicked off by the 2nd successful CI build, but is there any way for the finish build trigger not to fire if it contains no changes?

Potentially I could combine the two into one build, but that would then increase the time the CI build takes (currently 2 mins), and therefore increase the time taken (by 11 mins) to know the simple CI build has been broken.

Was it helpful?

Solution

I am assuming that your Setup Kit build has the following configuration:

  • A 'Finish Build Trigger' set to the CI Build, so that every time the CI Build is successfully completed, the Setup Kit build will run.
  • A VCS Root so that every time Setup Kit is run, it gets its own source from VCS.

The problem is that if CI Build takes two minutes, and there are more CI changes during that build, the Setup Kit build will use the source of when it started, rather than the source from the triggering CI Build. It's not the VCS Changes that are triggering the build, but the CI project, so it has nothing to do with there being VCS changes or not.

Snapshot Dependencies
What you are missing is a Snapshot Dependency. This is available through the 'Dependencies' configuration steps (#6). This will still do a project trigger, but will cause the CI Build and the Setup Kit build to use the same exact source code from the same timestamp. You will still get two Setup Kit builds, but each one will be directly correlated to a CI Build.

Quiet Periods
Because every successful CI Build will trigger a Setup Kit build, another option would be to reduce the number of CI Builds. By enabling a quiet period on the CI Build, CI will only kick off when there are changes and there has not been any new commit in X time. "Something changed. Let's wait 30 seconds to see if there are more changes coming. If there is nothing new then, we will trigger a build." This would put the two commits on a single CI Build which would result in a single Setup Kit Build.

Similarly, you can remove the Finish Build trigger on Setup Kit, and change it to a VCS Trigger with a quiet period; set the quiet period to slightly more than the time it takes the CI project to run. This will still allow you to have a CI Build for every commit, but will group together the Setup Kit builds when there are many quick commits. The downside is that it will no longer correlate to a successful CI Build. So, after 2 minutes (whatever your quiet period is) with no new changes, Setup Kit will fire, even if the CI Build is in a failed state.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top