Jenkins : Script SCM Plugin

Plugin Information

Distribution of this plugin has been suspended due to unresolved security vulnerabilities, see below.

The current version of this plugin may not be safe to use. Please review the following warnings before use:

The Script SCM plugin allows SCM polling to be managed using scripts.
The basic concept is as follows. 

The plugin allows a groovy script to be configured to manage SCM polling and checkout life cycle. The groovy script can be embedded directly on the config page of the project or a reference to an external groovy script file can be specified.
The plugin also provides the groovy script with a mechanism to invoke an external ant script. The idea is that the groovy script has access to the Jenkins API but not to the SCM. The ant script has access to the SCM but not to the jenkins API. The groovy script together with an ant script provides the communication link between the Jenkins API and the SCM. 

Whenever Jenkins polls the script-scm plugin for changes, the plugin invokes the groovy script passing in a variable called 'action' with the value 'compareWithRemoteVersion'.
The groovy script can then check the value of the 'action' variable and call an external ant script to detect changes in the SCM. When calling the external ant script the groovy script can pass in values like the time-stamp of the last successful build or the time-stamp of the last build or any additional information that the ant script requires from Jenkins. All the logic to determine the parameters that need to be passed to the ant script should be written in the groovy script. The logic to detect changes in the SCM should be written in the ant script.