matt-richardson / gocd-websocket-notifier

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

Exception when #12

Closed anjana83 closed 7 years ago

anjana83 commented 7 years ago

Hi,

Can you please help me here. I am learning gocd tool and need create plugin similar to websocket notifier.

I have downloaded latest jar from release and copied in /plugins/external. Now when I build pipeline in gocd, I am getting below error in log:

2017-01-17 22:29:47,220 WARN [Thread-70] GoNotificationPlugin:62 - Config file gocd-websocket-notifier.conf was not found in /app/home/go. Using default values. 2017-01-17 22:29:47,223 INFO [Thread-70] GoNotificationPlugin:52 - Starting WebSocket server started on port: 8887 2017-01-17 22:29:47,266 INFO [Thread-70] GoNotificationPlugin:52 - WebSocket server started on port: 8887 2017-01-17 22:36:29,975 INFO [69@MessageListener for PluginNotificationListener] WebSocketPipelineListener:52 - notify called with request name 'stage-status' and requestBody '{"pipeline":{"name":"hsd-qa-auto","counter":"24","group":"hsd-services-rs","build-cause":[{"material":{"pipeline-configuration":{"pipeline-name":"hsd-commit","stage-name":"build"},"type":"pipeline"},"changed":false,"modifications":[{"revision":"hsd-commit/36/build/1","modified-time":"2017-01-17T21:23:13.940Z","data":{}}]},{"material":{"git-configuration":{"shallow-clone":false,"branch":"master","url":"https://github.com/deployment-manifests.git"},"type":"git"},"changed":false,"modifications":[{"revision":"8b406e89f8384b17518f45864c76208c486515ca","modified-time":"2017-01-13T23:55:19.000Z","data":{}}]}],"stage":{"name":"deploy","counter":"1","approval-type":"success","approved-by":"admin","state":"Building","result":"Unknown","create-time":"2017-01-17T22:36:29.678Z","last-transition-time":"","jobs":[{"name":"push","schedule-time":"2017-01-17T22:36:29.678Z","complete-time":"","state":"Scheduled","result":"Unknown"}]}}}' 2017-01-17 22:36:30,154 ERROR [69@MessageListener for PluginNotificationListener] GoNotificationPlugin:77 - Failed to download pipeline instance details for requestBody '{"pipeline":{"name":"hsd-qa-auto","counter":"24","group":"hsd-services-rs","build-cause":[{"material":{"pipeline-configuration":{"pipeline-name":"hsd-commit","stage-name":"build"},"type":"pipeline"},"changed":false,"modifications":[{"revision":"hsd-commit/36/build/1","modified-time":"2017-01-17T21:23:13.940Z","data":{}}]},{"material":{"git-configuration":{"shallow-clone":false,"branch":"master","url":"https://github.comcast.com/apatel019c/deployment-manifests.git"},"type":"git"},"changed":false,"modifications":[{"revision":"8b406e89f8384b17518f45864c76208c486515ca","modified-time":"2017-01-13T23:55:19.000Z","data":{}}]}],"stage":{"name":"deploy","counter":"1","approval-type":"success","approved-by":"admin","state":"Building","result":"Unknown","create-time":"2017-01-17T22:36:29.678Z","last-transition-time":"","jobs":[{"name":"push","schedule-time":"2017-01-17T22:36:29.678Z","complete-time":"","state":"Scheduled","result":"Unknown"}]}}}' java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost:8153/go/api/pipelines/hsd-qa-auto/history at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1839) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440) at java.net.URLConnection.getContent(URLConnection.java:739) at com.matt_richardson.gocd.websocket_notifier.PipelineDetailsPopulator.downloadPipelineInstanceDetails(PipelineDetailsPopulator.java:48) at com.matt_richardson.gocd.websocket_notifier.PipelineDetailsPopulator.extendMessageToIncludePipelineDetails(PipelineDetailsPopulator.java:66) at com.matt_richardson.gocd.websocket_notifier.WebSocketPipelineListener.notify(WebSocketPipelineListener.java:19) at com.matt_richardson.gocd.websocket_notifier.GoNotificationPlugin.handleStageNotification(GoNotificationPlugin.java:95) at com.matt_richardson.gocd.websocket_notifier.GoNotificationPlugin.handle(GoNotificationPlugin.java:65) 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) 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) 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)

Also, I see in code: String sURL = "http://localhost:" + goHttpPort + "/go/api/pipelines/" + pipelineName + "/history"; Why this gocd host is always "localhost"? Can you please also let me know if I want to make any changes into code how can I build new jar.

Thanks so much. Anjana