Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-46366

REGRESSION: Github branch source does not consistently set up webhook

    Details

    • Similar Issues:
    • Sprint:
      Pipeline - December

      Description

      Summary: 

      Creating a pipeline via Github, either org folder or a single MBP, does not correctly setup webhooks. 

      To reproduce: 

      • Create a github token with correct scope allowing for admin of webhooks
      • Create a MBP with the github project type, using this credential
      • Note that there is no webhook created on the github project. 
      • You will see a message in the log like: 
        INFO: GitHub webhooks activated for job CodeValet with [] (events: [REPOSITORY])

       

      This also happens if you set it up via github org folders. R. Tyler Croy swears on his grave that it used to work (he used it on jenkins.io) so this is possibly a bad regression. 

       

      ---------

       

      See the attached screenshot, I haven't yet been able to figure out why sometimes, but mostly not, a webhook is created at an Org level.

      *Most* of the time this doesn't work, but sometimes it does. MUCH CONFUSION.

      Failed logs:

      Aug 23, 2017 5:45:23 AM org.jenkinsci.plugins.github.webhook.WebhookManager$1 run              
      INFO: GitHub webhooks activated for job CodeValet with [] (events: [REPOSITORY])   
      

      Successful logs:

      INFO: GitHub webhooks activated for job CodeValet with [] (events: [REPOSITORY])                          
      Aug 23, 2017 5:41:04 AM org.jenkinsci.plugins.github_branch_source.GitHubOrgWebHook register              
      INFO: A webhook was registered for the organization https://github.com/CodeValet                                                                                                                  
      Aug 23, 2017 5:41:05 AM org.jenkinsci.plugins.github.webhook.subscriber.PingGHEventSubscriber onEvent                                                                                             
      INFO: PING webhook received from org <https://api.github.com/orgs/CodeValet>!   
      

      Related-ish to JENKINS-46365

        Attachments

          Issue Links

            Activity

            Hide
            rtyler R. Tyler Croy added a comment -

            So Stephen Connolly, if I'm understanding the problem here correctly, it's that by default nothing is set up here:

            If that's the case, which I totally believe is realistic, then this is the default configuration with Blue Ocean and a freshly minted Jenkins instance.

            Which, Michael Neale, is such a laughably broken experience for new users with GitHub and Blue Ocean IMHO.

            Show
            rtyler R. Tyler Croy added a comment - So Stephen Connolly , if I'm understanding the problem here correctly, it's that by default nothing is set up here: If that's the case, which I totally believe is realistic, then this is the default configuration with Blue Ocean and a freshly minted Jenkins instance. Which, Michael Neale , is such a laughably broken experience for new users with GitHub and Blue Ocean IMHO.
            Hide
            michaelneale Michael Neale added a comment - - edited

            R. Tyler Croy right - if https://issues.jenkins-ci.org/browse/JENKINS-33228 is done - I was under the impression the defaults would be "more correct" - am I wrong? Is there something specific blue ocean could do to make the default better here? (blue ocean as of 1.3 does away with github org folders as its default mechanism, but I assume the problem remains). 

             

            (I think code monkey is more likely to be bit by this than anyone else, but yeah, this is confusing). I might re-open this to keep one eye on it from this angle, in case there is anything we can improve. 

            Show
            michaelneale Michael Neale added a comment - - edited R. Tyler Croy right - if https://issues.jenkins-ci.org/browse/JENKINS-33228  is done - I was under the impression the defaults would be "more correct" - am I wrong? Is there something specific blue ocean could do to make the default better here? (blue ocean as of 1.3 does away with github org folders as its default mechanism, but I assume the problem remains).    (I think code monkey is more likely to be bit by this than anyone else, but yeah, this is confusing). I might re-open this to keep one eye on it from this angle, in case there is anything we can improve. 
            Hide
            michaelneale Michael Neale added a comment -

            James Dumay the blue ocean angle might be bad defaults here BTW... 

            Show
            michaelneale Michael Neale added a comment - James Dumay the blue ocean angle might be bad defaults here BTW... 
            Hide
            stevenfoster Steven Foster added a comment -

            Just commenting my notes about this issue which I had to deal with recently.

            There are a few different problems interacting I think, most of them are covered already. The GitHub server does need to be configured under the GitHub plugin as you've seen. The second problem was a bit more hidden. From what I found, a branch needs to have been built AND have a checkout as part of the pipeline (my tests often had no checkouts so this took awhile to pin down) because of how the GitHub plugin determines repo names. This means that you need to press "re-register webhooks" on the global configuration, or re-save the MBP after a build in order to register the webhook. My workaround was to write a plugin that added a GitHubRepositoryNameContributor which checked the MBP configuration rather than the SCM of a run to get the name of the repo. It also uses an ItemListener to kick off the webhook registration, so it's not a nice solution.

            The symptom of this name resolution problem was the empty list in the log like in the example
            INFO: GitHub webhooks activated for job CodeValet with []
            although I don't know about the interaction with GitHub org folders.

            It's been a little while since I've looked at this so hopefully that's accurate info, assuming I'm not missing something important.

            Show
            stevenfoster Steven Foster added a comment - Just commenting my notes about this issue which I had to deal with recently. There are a few different problems interacting I think, most of them are covered already. The GitHub server does need to be configured under the GitHub plugin as you've seen. The second problem was a bit more hidden. From what I found, a branch needs to have been built AND have a checkout as part of the pipeline (my tests often had no checkouts so this took awhile to pin down) because of how the GitHub plugin determines repo names. This means that you need to press "re-register webhooks" on the global configuration, or re-save the MBP after a build in order to register the webhook. My workaround was to write a plugin that added a GitHubRepositoryNameContributor which checked the MBP configuration rather than the SCM of a run to get the name of the repo. It also uses an ItemListener to kick off the webhook registration, so it's not a nice solution. The symptom of this name resolution problem was the empty list in the log like in the example INFO: GitHub webhooks activated for job CodeValet with [] although I don't know about the interaction with GitHub org folders. It's been a little while since I've looked at this so hopefully that's accurate info, assuming I'm not missing something important.
            Hide
            michaelneale Michael Neale added a comment -

            Steven Foster rsandell mind if we close this in favour of https://issues.jenkins-ci.org/browse/JENKINS-48035 as a duplicate? 
             

            Show
            michaelneale Michael Neale added a comment - Steven Foster rsandell mind if we close this in favour of https://issues.jenkins-ci.org/browse/JENKINS-48035  as a duplicate?   

              People

              • Assignee:
                rsandell rsandell
                Reporter:
                rtyler R. Tyler Croy
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: