Deploy specific branch only at specific times of the day

I'm having trouble determining if this is already possible or not. If it is, or something similar, I'd really appreciate a little advice on how to accomplish this. If it's not, I'd like to make a feature request.

We use Git with the git-flow branching model. When we push to the "master" branch, I would like this deployed to production. However, we only want the deploy to occur between 2:00 AM and 3:00 AM. I considered a few different methods of doing this:

  1. Setting a Daily trigger to build at 2:00 AM. However, this will only build the default branch, and I'd like to keep our default branch set to "develop" so the "Start Build" button defaults to "develop". It will also build every night even if there have been no new commits to the master branch.
  2. Disabling automatic promotion on the pre-production stage, and setting a promotion condition to "$Server.Now.Hour$ = 2". However, it's not clear that the condition will wait, it seems like it will only be evaluated once (probably during the middle of the day) and stop the build there.
  3. Setting a Condition on the build "If the build was run by a trigger, THEN queue the build UNTIL branch=master AND $Server.Now.Hour$ = 2". This doesn't work because the branch=master condition blocks all other branches from building.


Does Continua already have a way to this?

If not, a few different proposals for how we could accomplish this:

  1. When setting a periodic trigger, allow specifying a branch name. It would also be nice to have a way to say "Don't trigger if there have been no new changesets since the last time this triggered." I think this would work exactly the way we want it to.
  2. Add a promotion condition that allows specifying "wait here until a specified time of day". We would then use a repository trigger, and as long as this lets other builds go through while the stage is awaiting promotion, I think this would also work exactly the way we want.
  3. Allow "and" and "or" logic in the Conditions page so we can say "Branch Name does not match 'master' OR (Branch Name matches 'master' AND $Server.Now.Hour$ = 2)". However, I think this might block any other builds from going through until this build finally meets the condition.


Hi Stephen

We have been discussing your post in the office for the last hour. The conclusion we came to is that Continua CI can't currently do what you need. 

As you noted,  the time triggers don't have a way of specifying the branches to build. That's doable, it's been on the todo list for a while.. so we'll tackle that asap. As for not triggering if there are no new changesets since the last build.. will have to investigate that further before I can comment on whether it can be done without major changes. 

Promotion conditions are only evaluated once (at the end of a stage) so they won't work. Configuration conditions also won't work for the reasons you mentioned. 

The team is fully tasked on other issues/features at the moment, I'm almost done with the work to resolve the deadlock issue and will take a look at this tomorrow. 

FWIW, another feature on the todo list, is the ability to map together branches from different repositories, so when I build branch a from repo A, use branch x from repo B.. at the moment, the non triggering repos always use the default branch. If only there were more hours in the day (and/or unlimted resources!).

 

That sounds great. Thanks so much for your help.

Hi Stephen

We should have a build with this feature next week. It’s working nicely here, just need a bit more testing. BTW, we are currently dogfooding a build with the changes I made to fix the deadlock issues you reported. So far so good, the caching has reduced the load on the db a huge amount, if all goes well I’ll merge that in to the production branch next week as well.

Hi Stephen

I just sent you an email with a new build, but in case others are interested, this build has the new options to set the repo branches on triggers :

http://downloads.finalbuilder.com/downloads/continua/1.0/ContinuaCI.Server.Setup_x64_1.0.0.2599.exe
  

http://downloads.finalbuilder.com/downloads/continua/1.0/ContinuaCI.Server.Setup_1.0.0.2599.exe 

http://downloads.finalbuilder.com/downloads/continua/1.0/ContinuaCI.Agent.Setup_x64_1.0.0.2599.exe 

http://downloads.finalbuilder.com/downloads/continua/1.0/ContinuaCI.Agent.Setup_1.0.0.2599.exe

We still need work on the Configuration conditions to allow you to discard builds based on a branch and time.