Is the second copy of the job triggered by polling or by a hook script which runs on each commit to the git repository?
If the second run of the job is triggered by polling, then I don't know any way to prevent the duplication (though I generally don't see that type of duplication myself). If the second run of the job is triggered by a hook script, then you may be able to prevent that second job running by not including the "sha1=xxx" argument in the hook script. I've found that if a "sha1=xxx" argument is included in the hook arguments, then the git plugin schedules a build of that SHA1, whether or not it has already been built. If the "sha1=xxx" argument is not included in the hook arguments, then the git plugin polls the remote repositories to see if there are any changes and only schedules a build if there are changes which have not been built. Mark Waite On Fri, Dec 11, 2015 at 1:14 AM Stefan Schiffler <[email protected]> wrote: > Hi all, > > i have a jenkins job that polls a git repository every 5 minutes. (These > facts cannot be changed so please do not answer like increase the poll > interval...) > The build time for the job is about 10 minutes. Now if the repository > changes a build starts and during the build is running, exactly the same > job is scheduled again twice. > So in the end for every change, jenkins runs the job 3 times. If the first > run waits in the queue before running, it is even worse... > > Is there a way to disable the git repository polling when a job is > scheduled and re-enable it after it finished? > > thanks for your answers. > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/9cdfcb6b-9dff-48f1-b003-48abff5b16be%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-users/9cdfcb6b-9dff-48f1-b003-48abff5b16be%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtHPKESKiLnbSMydsPAj76_i8pN1TYdHs5jpsFCVhfF_Rg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
