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:
- 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.
- 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.
- 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:
- 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.
- 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.
- 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.