tfs build wait since last check-in - tfs

When I check-in a file, the TFS CI trigger waits very little and starts the build. The problem is that I may have 10-30 files to check-in, and I would like the TFS to wait at least 5 minutes after my last file checked in before it starts a new CI build. In Cruise-Control I had a "modificationDelaySeconds" property where I could set the minimum amount of seconds to wait after the last check-in. How do I do this in TFS (2012)?

The closest alternative in TFS is to define Rolling Builds (also known as Batched-CI-builds).
Change the build trigger from Continuous Integration to Rolling Builds. This way, the build waits till the last build has finished; you can also configure that you do not want to build more often than every 5 minutes.

Related

Jenkins periodic build

Is there a possible to prevent the full jenkins job from running, that is periodically scheduled; if there is no SCM changes since the last build.
For example,
There is a daily night build, to create a build. The completion of this job triggers(upstream project) the automation testing job for that build.
I would like to be able to have two things
Stop the 1st build job, if there is no SCM change since the last job
2nd upstream automation test job runs only if it has not run for 1 week. (after it has been triggered by the 1st Job)
Thanks in advance
The first part is simple, instead of "Build periodically" set to "Poll SCM" with the same schedule. It's exactly what it does: periodically checking for changes and only running the job if there were some.
The second part (triggering another job with a time constraint) is more complicated. One option is "Throttle builds" (to 1 per week) in addition to your usual build triggering scheme. Another one is "Trigger builds remotely (e.g., from scripts)" option and checking whether required conditions are met in some sort of script or service.
For the first
Did you try the poll the SCM every night? If no changes, the Jenkins job wont start.
0 23 * * *
Will run every night at 11 p.m
for the second
use the following plugin : https://wiki.jenkins.io/display/JENKINS/Run+Condition+Plugin

How to specify build queue order on auto-triggered TFS builds

I have 2 build definitions setup in TFS (Microsoft Team Foundation Server) 2013. One build runs and deploys every time a change happens in my main branch. The other build is a rolling build, and is triggered at most ever 30 minutes upon changes in my main branch.
In the scenario where the second build hasn't been run in the last 30 minutes at the time of a code commit, both builds get triggered at the same time. I'd like for the first build to be queued first, and the rolling build to be queued second. Right now, the second build goes first, presumably because either the build definition name alphabetically comes first, or the build definition itself was created in the system first.
How is build queue order determined in this scenario, and what can be done to control this order?

TFS2013 Scheduled Builds: Manually triggered Builds are not being accounted for when Scheduled Build are kicked off

I'm having some trouble preventing a Scheduled Build from being automatically kicked off after the same build has been trigger manually and no changes are present.
Problem: The Build is scheduled to go out at 3am everyday but only if any changes have been made (the Settings option ‘Build even if nothing has changed since the previous build’ is Unchecked). The problem is that if you trigger a manual build and no changes are made afterwards, the Scheduled Build is still going to get triggered even if there are no changes. Please follow the scenario bellow for an example:
Scenario:
Scheduled build gets kicked off today at 3am - assembly version changes to 1.0.0.1
On the same day, several changes are checked-in before noon.
The same Build is kicked off manually at 1pm - assembly version changes to 1.0.0.2
No more check-ins are made after the manual build from 1pm
The next day at 3am the Scheduled build gets triggered which it shouldn't have (assembly version changes to 1.0.0.3) since there were no check-ins since 1pm (triggered manually).
It seems like the 1pm build is not even being considered and accounted for.
It looks like TFS is taking in count check-ins since the last “Scheduled Build” rather than “the last completed Build” (same build definition) which in this case was the manually triggered one.
So my question is: “Is there any way we can prevent TFS from triggering Scheduled build if there were no check-ins after a manual build has been kicked off?”
Currently, it looks like TFS does not have that option anywhere in the Build Definition
Thank you in advance
In order to do this you would need to write your own scheduler that checked the previous manual build for you. You could write a TfsJob for this or even as a a scheduled powershell that runs at the allotted time...
I ran into this issue today as well.
It seems this is currently "by design".
Someone else posted a suggestion to "fix" this here:
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/5702884--build-even-if-nothing-has-changed-since-the-previ

Jenkins Trigger X minutes after last build

We have recently switched from CruiseControl.Net to Jenkins for managing our builds. With CCNET it would trigger a new build X minutes after the last one completed, but with Jenkins it is constantly dropping builds in the queue, not allowing any time in between the two. We'd prefer the CCNET method.
I don't see how this can be done with the Scheduler Trigger, it seems to be all date time based.
I don't see any setting to prevent Queueing another build where the build is currently running.
I don't see a trigger that would allow for timing based off last run.
How could I manage this?
Jenkins lets you set a quiet period between builds, which can be set at the system level and overridden at the job level. Here's the help text from Jenkins:
If set, a newly scheduled build waits for this many seconds before actually being built. This is useful for:
Collapsing multiple CVS change notification e-mails into one (some CVS changelog e-mail generation scripts generate multiple e-mails in quick succession when a commit spans across directories).
If your coding style is such that you commit one logical change in a few cvs/svn operations, then setting a longer quiet period would prevent Jenkins from building it prematurely and reporting a failure.
Throttling builds. If your Jenkins installation is too busy with too many builds, setting a longer quiet period can reduce the number of builds.
If not explicitly set at project-level, the system-wide default value is used.
And here is a more detailed discussion.

TFS Rolling Build appears to skip building sometimes

Environment: TFS 2010
I met a strange issue on the TFS 2010.
I create a rolling build, and set it should be triggered no more often than every 30 minutes.
Usually, it works fine. I can find the build was triggered several times one day.
Then there is a long vacation and after I came back, the rolling build was not triggered in the last two days.
There is nothing changed for the build definition and TFS server.
It is very strange.
Does anyone know the reason or have the same situation?
BTW, I have a little question for rolling builds. That is, Rolling builds work when there are accumulate check-ins until the prior build finishes. If 1:00 AM, a rolling build was triggered, it will finish at 1:20. At 1:10 some new code was checked in, an other build such as nightly build was triggered before 1:20. Question: Is the rolling build triggered at 1:30?
The whole point of rolling builds is so they don't build up in a queue, basically it means if anyone checks in while a build is happening it won't trigger a build.
If you set a time, eg 30 minutes, it won't ever build within 30 minutes of a previous build.
For the next build to happen you need to check in again outside of those conditions (eg 30 minutes later)

Resources