jenkinsci / jenkinsci/github-branch-source-plugin

[JENKINS-64201] GitHub Org Folders webhooks management

Open
#1,326 0 comments 0 reactions 0 assignees View on GitHub
component:github-branch-source-plugin enhancement imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
217
Forks
398
Avg merge
30m
Merged PRs (30d)
1

Description

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.

---
Originally reported by llibicpep, imported from: GitHub Org Folders webhooks management


  • status: Open
  • priority: Minor
  • component(s): github-branch-source-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-02

Raw content of original issue

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.