On Mon, Mar 30, 2020 at 10:03 AM Roland Asmann <roland.asm...@gmail.com>
wrote:

> Thanks for the explanation. I do agree, I just thought it a bit weird
> that there was a difference in behavior...
>
> I still would like to know, what the consensus is to writing the
> Jenkinsfile: add polling or not?
>

Consensus is to not add polling.  The "polling must die" blog post is still
applicable, even with Pipeline.  Much better to find a way to have the git
repository notify Jenkins that a commit has arrived, rather than having
Jenkins periodically ask if a commit has arrived.

Major git providers (GitHub, Bitbucket, GitLab, Gitea) provide web hooks
that will notify Jenkins.  Many of those webhooks are even automatically
managed by Jenkins.  Jenkins servers behind firewalls can use web hook
routing tools to receive notifications inside the firewall from a git
hosting service outside the firewall.

Mark Waite


> Thanks.
>
>
> On 25.03.2020 14:53, Mark Waite wrote:
> > Multibranch pipelines assume that you want to build all branches that
> > include a Jenkinsfile any time the notification is received through
> > notifyCommit or through a Web Hook.  If you do not want one or more
> > branches built on multibranch pipelines, you'll need to exclude them.
> > The Basic Branch Build Strategies plugin (
> >
> https://github.com/jenkinsci/basic-branch-build-strategies-plugin/blob/master/docs/user.adoc)
>
> > provides many branch selection options.
> >
> > On Wed, Mar 25, 2020 at 7:39 AM Roland Asmann <roland.asm...@gmail.com
> > <mailto:roland.asm...@gmail.com>> wrote:
> >
> >     Hi everybody,
> >
> >     Way-back-when, Kohsuke wrote this post about how to setup CI with
> >     Git in Jenkins:
> >
> https://kohsuke.org/2011/12/01/polling-must-die-triggering-jenkins-builds-from-a-git-hook/
> >
> >     I have been using this in most my builds since and am still trying
> >     to get all colleagues to do the same (don't ask, my company can be
> >     difficult sometimes). Anyway, the other day I noticed that in one of
> >     my Jenkinsfiles, I forgot to activate the SCM polling. However, this
> >     project had been building on git pushes since the start!
> >
> >     Doing some testing on my own, I came to the following conclusion:
> >     - Non-pipeline jobs all need to have the polling activated to react
> >     to the Git hook
> >     - Single pipeline jobs also need to have polling activated
> >     - Multibranch pipelines **don't** need to have polling activated,
> >     they just build whenever the git hook sends its request to Jenkins
> >
> >     Now, my question is, is this behavior correct? Does it mean that for
> >     multibranch pipelines, I **can't** NOT do CI? (Except for removing
> >     the hook, but that might influence other builds as well!) Is this
> >     actual behavior documented somewhere and did I just miss this
> >     information?
> >
> >     And what is now the correct way to setup CI? Should I still add the
> >     polling in my Jenkinsfile or, if I am sure I will be using a
> >     multibranch pipeline, just leave it out?
> >
> >     Thanks.
> >
> >     Roland
> >
> >     --
> >     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 jenkinsci-users+unsubscr...@googlegroups.com
> >     <mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
> >     To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/jenkinsci-users/828bed5a-dda6-4782-82d9-6834b1f0e074%40googlegroups.com
> >     <
> https://groups.google.com/d/msgid/jenkinsci-users/828bed5a-dda6-4782-82d9-6834b1f0e074%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
> >
> > --
> > You received this message because you are subscribed to a topic in the
> > Google Groups "Jenkins Users" group.
> > To unsubscribe from this topic, visit
> >
> https://groups.google.com/d/topic/jenkinsci-users/IDXKJukzJbo/unsubscribe.
> > To unsubscribe from this group and all its topics, send an email to
> > jenkinsci-users+unsubscr...@googlegroups.com
> > <mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtF-Hx%3Ds5MvNssLoE5jDnzhhVu4HkuSvosNd_Y9zdoxmrA%40mail.gmail.com
> > <
> https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtF-Hx%3Ds5MvNssLoE5jDnzhhVu4HkuSvosNd_Y9zdoxmrA%40mail.gmail.com?utm_medium=email&utm_source=footer
> >.
>
> --
> 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 jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/10726501-9ed7-5d86-1147-1a83083c0a29%40gmail.com
> .
>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtHc8fTMno-uBSEv66djzVc-AjeYtid77K%3Dp11qqCB1QuA%40mail.gmail.com.

Reply via email to