views:

703

answers:

3

I am using one server to build the same project both continuously and nightly; however I would like the nightly build to only build if a modification exists during the day. I am hoping to achieve this with the constraint that both builds use the same working folder.

The two options I am considering are:

  1. Polling the continuous build and only build the nightly build if a continuous build has occurred - possibly using some token system (continuous build sets token, nightly clears token).

  2. Running a prebuild task to revert the source code to the Last Build Time

I am leaning towards the second option as it decouples the build scripts, but it seems to be a much harder task.

Suggestions and tips to doing this would be appreciated!

Added Information:

The CI build is a quick build of the solution in one configuration and maybe runs some fast unit tests.

The nightly build cleans the build environment, builds the software, packages into an installer, runs extended tests, labels the source code repository, deploys the installer to a server share for manual testers to pick up, and emails the test team that a testable build has been made.

I only want the nightly build to occur if there were any check-ins during the day so that testers don't get plagued with repeat emails for essentially the same build.

+3  A: 

I might be over simplifying this task but can't you simply setup two triggers on the project? One interval trigger for the continuous builds and one schedule trigger with the IfModificationExists condition for the nightly builds.

<triggers>
  <intervalTrigger seconds="60" name="Continuous" />
  <scheduleTrigger time="23:30" buildCondition="IfModificationExists" name="Scheduled">
      <weekDays>
        <weekDay>Monday</weekDay>
      </weekDays>
  </scheduleTrigger>
</triggers>
Trevor
That was my first thought as well, but the problem with this approach is that no modification will be detected for the scheduleTrigger.
Rob Hunter
That is correct. Which begs me to ask, what's the point of the nightly build if you're running CI? Wouldn't your code always be up to date?
Trevor
The CI build is a quick build of the solution in one configuration and maybe runs some fast unit tests. The nightly build cleans the build environment, packages into an installer, runs extended tests, labels the source code repository, deploys the installer to a server share for manual testers to pick up, and emails the test team that a testable build has been made. I only want the nightly build to occur if there were any check-ins during the day.I will modify my original question with this additional info too.
Rob Hunter
A: 

I have been giving some more thought on this...

Does anyone have experience using a MultiTrigger with nested Schedule and Project triggers for such a system?

The biggest issue that I see with this is that the nightly build would not show a modification history since the working files should be identical from the latest integration build. Since the at-night build would be given to testers, this history would be useful.

Rob Hunter
+1  A: 

I am happy with my new solution...

I use a MultiTrigger with a scheduleTrigger and a prjectTrigger on the nightly build (better to call full build) and WriteModification/ReadModification pairs to propagate the modification history like in this question.

Rob Hunter