Wehbook notification plugin

53 views
Skip to first unread message

Sylvain Fabre

unread,
Feb 19, 2024, 7:46:13 AMFeb 19
to go-cd
Hi there !

GoCD is a great tool, and we would like now to send Webhook notifications to our Mattermost server.
It seems that this plugin https://github.com/getsentry/gocd-webhook-notification-plugin used to do the job, but it does not work anymore with latest GoCD releases.

Do you know if there is another solution to push webhooks ? Is someone willing to update this plugin to the latest GoCD APIs  (sponsoring possible) ?

Thanks !

Ashwanth Kumar

unread,
Feb 19, 2024, 7:49:49 AMFeb 19
to go...@googlegroups.com
I would be happy to provide the necessary support that's needed. Let's connect offline. Sending you a message shortly. 

Thanks,


--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/f36cfd42-923e-44de-a5a6-68e12119bd5fn%40googlegroups.com.

Chad Wilson

unread,
Feb 19, 2024, 8:10:24 AMFeb 19
to go...@googlegroups.com
Does that plugin really not work?

I note the repo has recently been archived, but the plugin was updated relatively recently in 2023 and there haven't been any changes in those plugin APIs for quite a while to my knowledge - nor removal of old versions of the (plugin API) extension points.

In case there's a simple answer, might be worth sharing in which way it doesn't work?

-Chad


--

Sylvain Fabre

unread,
Feb 19, 2024, 9:29:38 AMFeb 19
to go...@googlegroups.com
Sure !

Here is the log when we add a hook URL in the plugin configuration :

Caused by: java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke "net.getsentry.gocd.webhooknotifier.Request.ordinal()" because the return value of "net.getsentry.gocd.we
bhooknotifier.Request.fromString(String)" is null
       at net.getsentry.gocd.webhooknotifier.WebhookNotifierPlugin.handle(WebhookNotifierPlugin.java:72)
       at com.thoughtworks.go.plugin.infra.DefaultPluginManager.lambda$submitTo$0(DefaultPluginManager.java:134)
       at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.executeActionOnTheService(FelixGoPluginOSGiFramework.java:205)
       ... 159 common frames omitted
Caused by: java.lang.NullPointerException: Cannot invoke "net.getsentry.gocd.webhooknotifier.Request.ordinal()" because the return value of "net.getsentry.gocd.webhooknotifier.Request.fromSt
ring(String)" is null
       at net.getsentry.gocd.webhooknotifier.WebhookNotifierPlugin.handle(WebhookNotifierPlugin.java:53)
       ... 161 common frames omitted


The webhook is in place, and has been tested independantly (and is working)

Thanks for your help,




You received this message because you are subscribed to a topic in the Google Groups "go-cd" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/go-cd/Wjwn06iKv-0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to go-cd+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/CAA1RwH8OgUjAGXVW%2Btd0C_%2BGsJigaqAJauyQnqt9iUeFvcQepA%40mail.gmail.com.

Chad Wilson

unread,
Feb 19, 2024, 9:54:08 AMFeb 19
to go...@googlegroups.com
If that error message comes after a log like WARN Error notifying plugin - xxxx with settings change but the plugin otherwise works OK, then you can probably ignore it. There are some optional request types that some plugins don't implement (and don't need to implement), but they don't always handle them so elegantly so they can log errors like the below.

If there are other concerns with the plugin or things we want to do with it but it otherwise is working OK, we could consider forking it into the gocd-contrib organisation to maintain it, since the Sentry folks don't appear to use/maintain it anymore.

-Chad

Sylvain Fabre

unread,
Feb 19, 2024, 11:00:41 AMFeb 19
to go-cd
Well in fact this log comes from the go-server.log file, but I have a full error in the log of the plugin itself :


2024-02-19 13:49:34,811 ERROR [qtp1928054064-42] WebhookNotifierPlugin:127 - Failed to refresh configuration
java.lang.NullPointerException: Cannot invoke "net.getsentry.gocd.webhooknotifier.Request.ordinal()" because the return value of "net.getsentry.gocd.webhooknotifier.Request.fromString(String
)" is null
       at net.getsentry.gocd.webhooknotifier.WebhookNotifierPlugin.handle(WebhookNotifierPlugin.java:53)
       at com.thoughtworks.go.plugin.infra.DefaultPluginManager.lambda$submitTo$0(DefaultPluginManager.java:134)
       at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.executeActionOnTheService(FelixGoPluginOSGiFramework.java:205)
       at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.doOn(FelixGoPluginOSGiFramework.java:164)
       at com.thoughtworks.go.plugin.infra.DefaultPluginManager.submitTo(DefaultPluginManager.java:131)
       at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:49)
       at com.thoughtworks.go.plugin.access.common.AbstractExtension.notifyPluginSettingsChange(AbstractExtension.java:82)
       at com.thoughtworks.go.server.service.PluginService.notifyPluginSettingsChange(PluginService.java:191)
       at com.thoughtworks.go.server.service.PluginService.updatePluginSettingsAndNotifyPluginSettingsChangeListeners(PluginService.java:167)
       at com.thoughtworks.go.server.service.PluginService.updatePluginSettings(PluginService.java:118)
       at com.thoughtworks.go.apiv1.pluginsettings.PluginSettingsControllerV1.update(PluginSettingsControllerV1.java:115)
       at spark.RouteImpl$1.handle(RouteImpl.java:72)

I suspect this error confirms that the plugin is broken with the latest GoCD versions.

Chad Wilson

unread,
Feb 19, 2024, 11:21:48 AMFeb 19
to go...@googlegroups.com
That's not necessarily true. All the error tells us is that the plugin couldn't handle a particular request type from the server. We need to know which request type to know if that is a problem. From the gocd-server.log you should look at the log lines before the stack trace - the ones with timestamps and WARN/ERROR. Please include those, or we don't know the context the server was in .

More importantly, if the plugin isn't working, it's probably better to describe what you actually observe rather than just what you interpret from the logs. (when stage X completed, I expected Y to happen but instead I observe Z)

Keep in mind that a "generic" webhook notification plugin is only going to work in some cases for certain target servers which expect a certain payload being sent to their webhooks which match what the plugin does. To my knowledge there is no such thing as a "generic" webhook standard format, but I haven't looked into it in detail. Mattermost would need to support/expect the same format as the plugin sends - so if the plugin is 'not working' it might be that it's not compatible with Mattermost rather than incompatible with GoCD. I suspect this is more likely to be your problem (the plugin doesn't do what you need it to do) than a GoCD compatibility issue - and that you need a .

From a quick look at https://developers.mattermost.com/integrate/webhooks/incoming/ the format it accepts is specific to Mattermost and is not what this "generic" plugin is sending. I believe Mattermost tries to adopt the same format as Slack so you might be better to try https://github.com/ashwanthkumar/gocd-slack-build-notifier (which happens to be written by Ashwanth who also responded on this thread) although no idea if it's Mattermost compatible.

-Chad

Sylvain Fabre

unread,
Feb 19, 2024, 6:06:58 PMFeb 19
to go-cd
Thanks for your answer !
After digging a bit, we discovered that Mattermost webhooks are compatible with Slack ones. We tested the plugin you mentionned above and ... it works :

Thanks !
(and so it means that the "Slack notification plugin" can also be tagged as "Mattermost notification plugin :) )

Sylvain Fabre

unread,
Feb 19, 2024, 6:07:12 PMFeb 19
to go-cd
Thanks !

In fact the Slack notification plugin is doing the job, you are right !

Chad Wilson

unread,
Feb 20, 2024, 12:54:41 AMFeb 20
to go...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages