matt-richardson / gocd-websocket-notifier

GoCD plugin to publish build notifications via websockets to any listener
11 stars 7 forks source link

Notification update failed #9

Closed chen01 closed 8 years ago

chen01 commented 8 years ago

So I've taken the latest build and just made a few changes in the PipelineDetailesPopulator to accommodate HTTPS and changed the port. I hit this exception in the go server logs, wondering if you have seen this before? Really appreciate your help!

@matt-richardson

2016-09-14 22:14:38,842  WARN [69@MessageListener for PluginNotificationListener] PluginNotificationService:78 - Notification update failed for plugin: gocd.websocket.notifier
java.lang.RuntimeException: Interaction with plugin with id 'gocd.websocket.notifier' implementing 'notification' extension failed while requesting for 'stage-status'. Reason: [com/matt_richardson/gocd/websocket_notifier/PipelineDetailsPopulator$1]
    at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:38)
    at com.thoughtworks.go.plugin.access.notification.NotificationExtension.notify(NotificationExtension.java:66)
    at com.thoughtworks.go.server.messaging.plugin.PluginNotificationService.notifyPlugin(PluginNotificationService.java:61)
    at com.thoughtworks.go.server.messaging.plugin.PluginNotificationService.notifyPlugins(PluginNotificationService.java:53)
    at com.thoughtworks.go.server.messaging.plugin.PluginNotificationListener.onMessage(PluginNotificationListener.java:30)
    at com.thoughtworks.go.server.messaging.plugin.PluginNotificationListener.onMessage(PluginNotificationListener.java:21)
    at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.runImpl(JMSMessageListenerAdapter.java:65)
    at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.run(JMSMessageListenerAdapter.java:50)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: com/matt_richardson/gocd/websocket_notifier/PipelineDetailsPopulator$1
    at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.executeActionOnTheService(FelixGoPluginOSGiFramework.java:317)
    at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.doOn(FelixGoPluginOSGiFramework.java:245)
    at com.thoughtworks.go.plugin.infra.DefaultPluginManager.submitTo(DefaultPluginManager.java:167)
    at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:32)
    ... 8 more
Caused by: java.lang.NoClassDefFoundError: com/matt_richardson/gocd/websocket_notifier/PipelineDetailsPopulator$1
    at com.matt_richardson.gocd.websocket_notifier.PipelineDetailsPopulator.downloadPipelineInstanceDetails(PipelineDetailsPopulator.java:38)
    at com.matt_richardson.gocd.websocket_notifier.PipelineDetailsPopulator.extendMessageToIncludePipelineDetails(PipelineDetailsPopulator.java:73)
    at com.matt_richardson.gocd.websocket_notifier.WebSocketPipelineListener.notify(WebSocketPipelineListener.java:19)
    at com.matt_richardson.gocd.websocket_notifier.GoNotificationPlugin.handleStageNotification(GoNotificationPlugin.java:88)
    at com.matt_richardson.gocd.websocket_notifier.GoNotificationPlugin.handle(GoNotificationPlugin.java:58)
    at com.thoughtworks.go.plugin.infra.DefaultPluginManager$1.execute(DefaultPluginManager.java:172)
    at com.thoughtworks.go.plugin.infra.DefaultPluginManager$1.execute(DefaultPluginManager.java:167)
    at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.executeActionOnTheService(FelixGoPluginOSGiFramework.java:315)
    ... 11 more
matt-richardson commented 8 years ago

Hmm. I hit that "port is hardcoded" issue last night when I was trying to flesh out some tests. Sorry to see you're hitting so many issues!

Can you start a PR with your changes and I can take a look?

chen01 commented 8 years ago

Here it is! https://github.com/matt-richardson/gocd-websocket-notifier/pull/10/

Thanks for taking a look

matt-richardson commented 8 years ago

What version of java are you running? (I'm clutching at straws here). It appears to build and run successfully (mostly) on travis so it looks like its happy under jdk 1.7?

(I really don't know that much java to be honest - I'm still learning...)

What version of GoCD?

chen01 commented 8 years ago

I'm running Go version 16.5. I've actually changed everything over to just use the HTTP port, I still needed to add basic authentication

I am not seeing errors anymore in logs... but I'm still not seeing notifications through the websocket. I'm not very versed in websocketry, but I should be able to see messages come through if I connect to it using socat - TCP4-CONNECT:<host>:<port> right?

When I get the chance I'll see if I can modify it to take custom ports for Go server and maybe authentication as well

matt-richardson commented 8 years ago

I wonder how much of this information is available via the GoApplicationAccessor...? When I wrote the plugin originally, the plugin model was still in flux, so it may have improved.

Hmm... I just had a look, and it doesn't appear to be able to give the information we need. I might be wrong though.

As for testing whether it works, I use http://www.websocket.org/echo.html. I've never come across socat before.

You might want to check out the integration tests - they should run on any *nix system that has the docker daemon available.

chen01 commented 8 years ago

hmm the sole issue I'm having right now I think is just not being able to connect to the websocket. Whenever I try to connect to the ws uri wss://<host>:<port> it just closes with code 1006... which give me no information on what is going wrong.

should it be ws or wss?

I'll take a look at the integration tests and see

matt-richardson commented 8 years ago

It will be ws:// as it's a non secure web socket.

matt-richardson commented 8 years ago

Did you have any luck resolving this, @chen01?

chen01 commented 8 years ago

@matt-richardson yes! thanks for your help, it turns out it was a problem with my client, but the error code wasn't all that helpful so it took a while to figure out. I'm working on a few changes to have custom go server ports and basic authentication for getting pipeline history. Just testing the changes now and will make PR when finished!