edx/git-plugin — pull request #2 by wedaly (2013-10-23 12:18:26+00:00)
Title: Implement old commit cutoff feature.

Currently, the Jenkins git plugin checks for new commits on all branches and triggers builds if commits are found. This has two unfortunate implications:

1) When we create a new job in Jenkins, it needs to build every existing branch, of which we have hundreds. In addition, we're using GitHub's pull-request branches, which are never deleted. That means we have to process >1300 branches in new Jenkins instances.

2) In order to "remember" that it has already built an old commit, Jenkins checks completed builds. That means we cannot discard old builds. Even worse, it means that Jenkins has to read each of these builds from disk to decide whether to build any commit. This is slow.

My changes here solve the problem by creating a "cutoff" for old builds. In the advanced settings for the Git plugin, you can now specify "cutoff hours." If a commit date is older than this number of hours, it will be ignored when finding candidate branches.

Branches outside the cutoff are filtered before checking that we've already built the branch. These means we need to do fewer checks to see if we've already built the commit. It also means we can discard old builds.

One implication of this is that Jenkins jobs could fail if it doesn't find any commits that are new enough to build. This won't affect us, since we have a separate "trigger" job. If the "trigger" job fails, no one sees it, so it doesn't matter.