cloudnative / teamcity-webhooks

A TeamCity plugin that sends the results of a build to a webhook URL
Apache License 2.0
9 stars 10 forks source link

Error when first VCS root is not GIT #1

Open DVGeoffrey opened 8 years ago

DVGeoffrey commented 8 years ago

Was expecting a webhook request on build finish and never got one. Looked at the server logs and found this:

[2015-11-11 11:02:10,482]  ERROR -   jetbrains.buildServer.SERVER - WebHooks plugin - Failed to listen on buildFinished() of 'DevOps Testing :: Deployments - Staging Area :: Deployment - JIRA 2' #18.DevOpsTesting_DeploymentsStagingArea_DeploymentJIRA2
java.lang.NullPointerException
    at io.cloudnative.teamcity.WebhooksListener.buildPayload(WebhooksListener.java:67)
    at io.cloudnative.teamcity.WebhooksListener.buildFinished(WebhooksListener.java:43)
    at sun.reflect.GeneratedMethodAccessor271.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at jetbrains.buildServer.util.EventDispatcher.dispatch(EventDispatcher.java:117)
    at jetbrains.buildServer.serverSide.ServerSideEventDispatcher.superDispatch(ServerSideEventDispatcher.java:2)
    at jetbrains.buildServer.serverSide.ServerSideEventDispatcher$1.run(ServerSideEventDispatcher.java)
    at jetbrains.buildServer.serverSide.impl.auth.SecurityContextImpl.runAs(SecurityContextImpl.java:8)
    at jetbrains.buildServer.serverSide.impl.auth.SecurityContextImpl.runAsSystem(SecurityContextImpl.java:26)
    at jetbrains.buildServer.serverSide.ServerSideEventDispatcher.dispatch(ServerSideEventDispatcher.java:14)
    at jetbrains.buildServer.util.EventDispatcher$2.invoke(EventDispatcher.java:67)
    at com.sun.proxy.$Proxy18.buildFinished(Unknown Source)
    at jetbrains.buildServer.serverSide.impl.RunningBuildsManagerImpl.finishBuild(RunningBuildsManagerImpl.java:200)
    at jetbrains.buildServer.serverSide.impl.RunningBuildsManagerImpl$2$1.run(RunningBuildsManagerImpl.java:1)
    at jetbrains.buildServer.util.NamedThreadFactory.executeWithNewThreadName(NamedThreadFactory.java:89)
    at jetbrains.buildServer.serverSide.impl.RunningBuildsManagerImpl$2.run(RunningBuildsManagerImpl.java:1)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
DVGeoffrey commented 8 years ago

Seems to be an issue with this line: https://github.com/cloudnative/teamcity-webhooks/blob/master/src/main/java/io/cloudnative/teamcity/WebhooksListener.java#L67

Can't be sure but it looks like theres an assumption that the first "VCS Root" is GIT. Most of my projects use SVN so I got this error. When I added a dummy GIT repository and made it the first checkout, I started getting webhook requests again.

pas256 commented 8 years ago

@evgeny-goldin Would you mind taking a look at this please?

Thanks.

evgeny-goldin commented 8 years ago

Thanks for diagnosis, Geoffrey. I'll change the code to skip non-Git VCS roots.

moinois commented 8 years ago

Has this gone into the released code yet? I'm having the same issue since I'm only having a Subversion repo. Is there a way to patch this?