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

GitHub Org Folders webhooks management

XMLWordPrintable

      Comparing to GitHub plugin, which allows to manage separate webhook URL (which often is not the same as Jenkins url since Jenkins usually is internal network resource while webhook endpoint needs to be publicly accessible) as well as shared secret token for it via Jenkins configuration, there is no similar functionality for GitHub Orgs.

      For GitHub Plugin, I can do something like:

       

      import org.jenkinsci.plugins.github.config.GitHubPluginConfig
      def descriptor = jenkins.model.Jenkins.getInstance().getDescriptorOrDie(GitHubPluginConfig.class)
       descriptor.setHookUrl('https://myjenkins/github-webhook/')
       def sharedToken = descriptor.getHookSecretConfig()
       sharedToken.setCredentialsId('jenkins-github-webhook-token')
       descriptor.setHookSecretConfig(sharedToken)
       descriptor.save()
      

       
      For GitHub Org Folders, all I could find is an undocumented feature in code - seems like setting `jenkins.hook.url` system property will override default Jenkins URL yet it won't allow me to set the shared secret.
       
      Also there seems to be no easy way to re-register all existing hooks similarly to how GitHub plugin has that "Re-register hooks for all jobs" button. The only workaround I found is that I need to manually delete `github-webhooks/*` files in Jenkins folder, manually delete hook on GitHub Org, and re-save Folders Jobs with no changes to trigger new hook registration.
       
      This functionality is not on pair with GitHub Plugin and needs improvements.

            Unassigned Unassigned
            llibicpep Dee Kryvenko
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: