Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access Jenkins github-webhook script to change GitHub URL

Our Jenkins deployment jobs have worked flawlessly for years.

GitHub is set to call https://jenkins.[our-company]/github-webhook/ whenever a push event occurs. Then Jenkins receives the GitHub json payload, parses the data, and starts a build/job script.

Recently, GitHub updated their system to change the url value returned in the API and it broke Jenkins.

https://github.blog/changelog/2025-04-07-changes-to-the-repository-object-in-push-webhook/

Now, Jenkins throws an error:

WARNING org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber onEvent
Malformed repo url https://api.github.com/repos/[our-company]/[our-repo]

It used to call https://github.com/[our-company]/[our-repo].

I assume somewhere in the github-webhook script, it is using url to fetch the repo. Now that GitHub changed the value in that variable, the URL doesn't work, so the build/job script is never triggered.

How can I change the variable used in the github-webhook script? Where is that even located?

FYI, there are no references to it in our Jenkins global configurations or jobs. Jenkins isn't even hitting an individual job; it's dying during the initial URL callback to GitHub. I've looked all over the Jenkins GUI and our server scripts and cannot find where those values are getting set or what script Jenkins actually calls when responding to https://jenkins.goodlooking.company/github-webhook/

I tried re-delivering the payload from GitHub. It always fails. I tried restarting Jenkins. It hasn't helped. Everything worked on April 6 and stopped working on April 8th, so I know the GitHub update on April 7th caused the issue.

like image 326
GoodLooking Avatar asked Oct 24 '25 06:10

GoodLooking


1 Answers

Updates:

  1. April 26th, 2025: I submitted a PR myself to hopefully fix this.

  2. May 5th, 2025: It was merged but no release has been made since. You can manually install the latest version of the plugin following the installation directions in the interim.

  3. July 20th, 2025: It was released in v1.44.0.


This seems to be a breaking change from GitHub and there is a recently opened bug report for the Jenkins GitHub plugin to resolve this. Quoting the issue:

The contents of the request Body of GitHub's WebHook have been changed. https://github.blog/changelog/2025-04-07-changes-to-the-repository-object-in-push-webhook/

url will provide the API URL (e.g., https://api.github.com/repos/<org>/<reponame>).

Therefore, it does not match the URL_PATTERNS check in the GitHub Plugin and the hook does not work properly.

It seems like you'll have to wait for a fix and new release from the GitHub plugin, and then update the plugin on your Jenkins instance.

like image 52
agilgur5 Avatar answered Oct 27 '25 02:10

agilgur5



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!