[JIRA] (JENKINS-53946) Bitbucket plugin unable to parse a Pull Request JSON Object

2018-10-16 Thread francisco.rodrig...@tomtom.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Francisco A. R. Vivas updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-53946  
 
 
  Bitbucket plugin unable to parse a Pull Request JSON Object   
 

  
 
 
 
 

 
Change By: 
 Francisco A. R. Vivas  
 
 
Priority: 
 Minor Major  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-53946) Bitbucket plugin unable to parse a Pull Request JSON Object

2018-10-16 Thread francisco.rodrig...@tomtom.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Francisco A. R. Vivas commented on  JENKINS-53946  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Bitbucket plugin unable to parse a Pull Request JSON Object   
 

  
 
 
 
 

 
 I have try to fix this and I found some important differences between Bitbucket Server and Bitbucket Cloud. https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html https://confluence.atlassian.com/bitbucketserver0513/event-payload-957493824.html As we can see in the Event Payload section of both systems, they are different enough to not be able to fix it quickly.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-28877) Bitbucket Plugin unable to parse Bitbucket webhook response json

2018-10-08 Thread francisco.rodrig...@tomtom.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Francisco A. R. Vivas edited a comment on  JENKINS-28877  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Bitbucket Plugin unable to parse Bitbucket webhook response json   
 

  
 
 
 
 

 
 [~kcuser], I have the same problem with "Approved" pull request event option.As far as I can see here is where Jenkins Bitbucket Plugin fails:[https://github.com/jenkinsci/bitbucket-plugin/blob/ce068b7f2cbf5250aa6d54c3acdd455d45b56246/src/main/java/com/cloudbees/jenkins/plugins/BitbucketPayloadProcessor.java#L24]I have captured the request and repeated here as a curl:{code}curl -X POST \  http://URL/bitbucket-hook/ \  -H 'Cache-Control: no-cache' \  -H 'Content-Type: application/json; charset=utf-8' \  -H 'Postman-Token: 3d72a314-48e1-45ff-832a-950d43a7435d' \  -H 'X-Event-Key: pr:reviewer:approved' \  -H 'X-Request-Id: 0d6f5c89-f29b-4c8a-9fc4-a6fd1846bafb' \  -d '{"eventKey":"pr:reviewer:approved","date":"2018-10-08T14:29:51+0200","actor":{"name":"authorUserReplaced","emailAddress":"authorReplaced","id":13761,"displayName":"authorReplaced","active":true,"slug":"authorUserReplaced","type":"NORMAL"},"pullRequest":{"id":2,"version":5,"title":"test edited online with Bitbucket","description":"abaöldflj","state":"OPEN","open":true,"closed":false,"createdDate":1538055333000,"updatedDate":153809000,"fromRef":{"id":"refs/heads/feature/checkitagain","displayId":"feature/checkitagain","latestCommit":"d5b55683288bc89c23609f3087a02b6daf7eef06","repository":{"slug":"bitbucket-test","id":1960,"name":"bitbucket-test","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"DVSPRT","id":346,"name":"Development Support","description":" Everything related to development support, build system, development infrastructure. See https://confluence.tomtomgroup.com/x/bpB_K and https://tttjira.ttg.global:8441/browse/DVSPRT ","public":false,"type":"NORMAL"},"public":false}},"toRef":{"id":"refs/heads/master","displayId":"master","latestCommit":"ad359c8a9ba1eaf0bd2adec3aa37492c63966afb","repository":{"slug":"bitbucket-test","id":1960,"name":"bitbucket-test","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"DVSPRT","id":346,"name":"Development Support","description":" Everything related to development support, build system, development infrastructure. See https://confluence.tomtomgroup.com/x/bpB_K and https://tttjira.ttg.global:8441/browse/DVSPRT ","public":false,"type":"NORMAL"},"public":false}},"locked":false,"author":{"user":{"name":"otherUserReplaced","emailAddress":"otherUserReplaced","id":11708,"displayName":"otherUserReplaced","active":true,"slug":"otherUserReplaced","type":"NORMAL"},"role":"AUTHOR","approved":false,"status":"UNAPPROVED"},"reviewers":[{"user":{"name":"authorUserReplaced","emailAddress":"authorReplaced","id":13761,"displayName":"authorReplaced","active":true,"slug":"authorUserReplaced","type":"NORMAL"},"lastReviewedCommit":"d5b55683288bc89c23609f3087a02b6daf7eef06","role":"REVIEWER","approved":true,"status":"APPROVED"}],"participants":[]},"participant":{"user":{"name":"authorUserReplaced","emailAddress":"authorReplaced","id":13761,"displayName":"authorReplaced","active":true,"slug":"authorUserReplaced","type":"NORMAL"},"lastReviewedCommit":"d5b55683288bc89c23609f3087a02b6daf7eef06","role":"REVIEWER","approved":true,"status":"APPROVED"},"previousStatus":"UNAPPROVED"}'{code}And has the same response that Bitbucket receive:{code:java}net.sf.json.JSONException: JSONObject["user"] not found. at net.sf.json.JSONObject.getString(JSONObject.java:2040) at com.cloudbees.jenkins.plugins.BitbucketPayloadProcessor.processPostServicePayload(BitbucketPayloadProcessor.java:128) at 

[JIRA] (JENKINS-53946) Bitbucket plugin unable to parse a Pull Request JSON Object

2018-10-08 Thread francisco.rodrig...@tomtom.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Francisco A. R. Vivas updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-53946  
 
 
  Bitbucket plugin unable to parse a Pull Request JSON Object   
 

  
 
 
 
 

 
Change By: 
 Francisco A. R. Vivas  
 

  
 
 
 
 

 
 I have created this issue after reading JENKINS-28877 and JENKINS-29096. Please, pay attention to the JSON provided as body for the CURL request to test its way of works. I have configured a Webhook in Bitbucket Server 13.1 to be triggered by Approved event. I have received a HTTP 500 error, and get the same response with the next CURL code. Here is the error from Bitbucket UI:{code:java}net.sf.json.JSONException: JSONObject["user"] not found. at net.sf.json.JSONObject.getString(JSONObject.java:2040) at com.cloudbees.jenkins.plugins.BitbucketPayloadProcessor.processPostServicePayload(BitbucketPayloadProcessor.java:128) at com.cloudbees.jenkins.plugins.BitbucketPayloadProcessor.processPayload(BitbucketPayloadProcessor.java:37) at com.cloudbees.jenkins.plugins.BitbucketHookReceiver.doIndex(BitbucketHookReceiver.java:54) at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117) at org.kohsuke.stapler.IndexDispatcher.dispatch(IndexDispatcher.java:26) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:734) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:864) at org.kohsuke.stapler.MetaClass$10.dispatch(MetaClass.java:374) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:734) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:864) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:668) at org.kohsuke.stapler.Stapler.service(Stapler.java:238) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:860) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154) at org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:243) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at io.jenkins.blueocean.auth.jwt.impl.JwtAuthenticationFilter.doFilter(JwtAuthenticationFilter.java:61) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at com.smartcodeltd.jenkinsci.plugin.assetbundler.filters.LessCSS.doFilter(LessCSS.java:47) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at io.jenkins.blueocean.ResourceCacheControl.doFilter(ResourceCacheControl.java:134) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:239) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:215) at net.bull.javamelody.PluginMonitoringFilter.doFilter(PluginMonitoringFilter.java:88) at 

[JIRA] (JENKINS-53946) Bitbucket plugin unable to parse a Pull Request JSON Object

2018-10-08 Thread francisco.rodrig...@tomtom.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Francisco A. R. Vivas updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-53946  
 
 
  Bitbucket plugin unable to parse a Pull Request JSON Object   
 

  
 
 
 
 

 
Change By: 
 Francisco A. R. Vivas  
 

  
 
 
 
 

 
 I have created this issue after reading JENKINS-28877 and JENKINS-29096. Please, pay attention to the JSON provided as body for the CURL request to test its way of works. I have configured a Webhook in Bitbucket Server 13.1 to be triggered by Approved event. I have received a HTTP 500 error, and get the same response with the next CURL code. Here is the error from Bitbucket UI:{code:java}net.sf.json.JSONException: JSONObject["user"] not found. at net.sf.json.JSONObject.getString(JSONObject.java:2040) at com.cloudbees.jenkins.plugins.BitbucketPayloadProcessor.processPostServicePayload(BitbucketPayloadProcessor.java:128) at com.cloudbees.jenkins.plugins.BitbucketPayloadProcessor.processPayload(BitbucketPayloadProcessor.java:37) at com.cloudbees.jenkins.plugins.BitbucketHookReceiver.doIndex(BitbucketHookReceiver.java:54) at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117) at org.kohsuke.stapler.IndexDispatcher.dispatch(IndexDispatcher.java:26) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:734) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:864) at org.kohsuke.stapler.MetaClass$10.dispatch(MetaClass.java:374) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:734) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:864) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:668) at org.kohsuke.stapler.Stapler.service(Stapler.java:238) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:860) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154) at org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:243) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at io.jenkins.blueocean.auth.jwt.impl.JwtAuthenticationFilter.doFilter(JwtAuthenticationFilter.java:61) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at com.smartcodeltd.jenkinsci.plugin.assetbundler.filters.LessCSS.doFilter(LessCSS.java:47) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at io.jenkins.blueocean.ResourceCacheControl.doFilter(ResourceCacheControl.java:134) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:239) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:215) at net.bull.javamelody.PluginMonitoringFilter.doFilter(PluginMonitoringFilter.java:88) at 

[JIRA] (JENKINS-28877) Bitbucket Plugin unable to parse Bitbucket webhook response json

2018-10-08 Thread francisco.rodrig...@tomtom.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Francisco A. R. Vivas edited a comment on  JENKINS-28877  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Bitbucket Plugin unable to parse Bitbucket webhook response json   
 

  
 
 
 
 

 
 [~kcuser], I have the same problem with "Approved" pull request event option.As far as I can see here is where Jenkins Bitbucket Plugin fails:[https://github.com/jenkinsci/bitbucket-plugin/blob/ce068b7f2cbf5250aa6d54c3acdd455d45b56246/src/main/java/com/cloudbees/jenkins/plugins/BitbucketPayloadProcessor.java#L24]I have captured the request and repeated here as a curl:{code}curl -X POST \  http:// ttbsbld102.dev.ttw:8080 URL /bitbucket-hook/ \  -H 'Cache-Control: no-cache' \  -H 'Content-Type: application/json; charset=utf-8' \  -H 'Postman-Token: 3d72a314-48e1-45ff-832a-950d43a7435d' \  -H 'X-Event-Key: pr:reviewer:approved' \  -H 'X-Request-Id: 0d6f5c89-f29b-4c8a-9fc4-a6fd1846bafb' \  -d '{"eventKey":"pr:reviewer:approved","date":"2018-10-08T14:29:51+0200","actor":{"name":"authorUserReplaced","emailAddress":"authorReplaced","id":13761,"displayName":"authorReplaced","active":true,"slug":"authorUserReplaced","type":"NORMAL"},"pullRequest":{"id":2,"version":5,"title":"test edited online with Bitbucket","description":"abaöldflj","state":"OPEN","open":true,"closed":false,"createdDate":1538055333000,"updatedDate":153809000,"fromRef":{"id":"refs/heads/feature/checkitagain","displayId":"feature/checkitagain","latestCommit":"d5b55683288bc89c23609f3087a02b6daf7eef06","repository":{"slug":"bitbucket-test","id":1960,"name":"bitbucket-test","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"DVSPRT","id":346,"name":"Development Support","description":"Everything related to development support, build system, development infrastructure. See https://confluence.tomtomgroup.com/x/bpB_K and https://tttjira.ttg.global:8441/browse/DVSPRT","public":false,"type":"NORMAL"},"public":false}},"toRef":{"id":"refs/heads/master","displayId":"master","latestCommit":"ad359c8a9ba1eaf0bd2adec3aa37492c63966afb","repository":{"slug":"bitbucket-test","id":1960,"name":"bitbucket-test","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"DVSPRT","id":346,"name":"Development Support","description":"Everything related to development support, build system, development infrastructure. See https://confluence.tomtomgroup.com/x/bpB_K and https://tttjira.ttg.global:8441/browse/DVSPRT","public":false,"type":"NORMAL"},"public":false}},"locked":false,"author":{"user":{"name":"otherUserReplaced","emailAddress":"otherUserReplaced","id":11708,"displayName":"otherUserReplaced","active":true,"slug":"otherUserReplaced","type":"NORMAL"},"role":"AUTHOR","approved":false,"status":"UNAPPROVED"},"reviewers":[{"user":{"name":"authorUserReplaced","emailAddress":"authorReplaced","id":13761,"displayName":"authorReplaced","active":true,"slug":"authorUserReplaced","type":"NORMAL"},"lastReviewedCommit":"d5b55683288bc89c23609f3087a02b6daf7eef06","role":"REVIEWER","approved":true,"status":"APPROVED"}],"participants":[]},"participant":{"user":{"name":"authorUserReplaced","emailAddress":"authorReplaced","id":13761,"displayName":"authorReplaced","active":true,"slug":"authorUserReplaced","type":"NORMAL"},"lastReviewedCommit":"d5b55683288bc89c23609f3087a02b6daf7eef06","role":"REVIEWER","approved":true,"status":"APPROVED"},"previousStatus":"UNAPPROVED"}'{code}And has the same response that Bitbucket receive:{code:java}net.sf.json.JSONException: JSONObject["user"] not found. at net.sf.json.JSONObject.getString(JSONObject.java:2040) at com.cloudbees.jenkins.plugins.BitbucketPayloadProcessor.processPostServicePayload(BitbucketPayloadProcessor.java:128) at 

[JIRA] (JENKINS-28877) Bitbucket Plugin unable to parse Bitbucket webhook response json

2018-10-08 Thread francisco.rodrig...@tomtom.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Francisco A. R. Vivas edited a comment on  JENKINS-28877  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Bitbucket Plugin unable to parse Bitbucket webhook response json   
 

  
 
 
 
 

 
 [~kcuser], I have the same problem with "Approved" pull request event option.As far as I can see here is where Jenkins Bitbucket Plugin fails:[https://github.com/jenkinsci/bitbucket-plugin/blob/ce068b7f2cbf5250aa6d54c3acdd455d45b56246/src/main/java/com/cloudbees/jenkins/plugins/BitbucketPayloadProcessor.java#L24]I have captured the request and repeated here as a curl:{code}curl -X POST \  http://ttbsbld102.dev.ttw:8080/bitbucket-hook/ \  -H 'Cache-Control: no-cache' \  -H 'Content-Type: application/json; charset=utf-8' \  -H 'Postman-Token: 3d72a314-48e1-45ff-832a-950d43a7435d' \  -H 'X-Event-Key: pr:reviewer:approved' \  -H 'X-Request-Id: 0d6f5c89-f29b-4c8a-9fc4-a6fd1846bafb' \  -d '{"eventKey":"pr:reviewer:approved","date":"2018-10-08T14:29:51+0200","actor":{"name":"authorUserReplaced","emailAddress":"authorReplaced","id":13761,"displayName":"authorReplaced","active":true,"slug":"authorUserReplaced","type":"NORMAL"},"pullRequest":{"id":2,"version":5,"title":"test edited online with Bitbucket","description":"abaöldflj","state":"OPEN","open":true,"closed":false,"createdDate":1538055333000,"updatedDate":153809000,"fromRef":{"id":"refs/heads/feature/checkitagain","displayId":"feature/checkitagain","latestCommit":"d5b55683288bc89c23609f3087a02b6daf7eef06","repository":{"slug":"bitbucket-test","id":1960,"name":"bitbucket-test","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"DVSPRT","id":346,"name":"Development Support","description":"Everything related to development support, build system, development infrastructure. See https://confluence.tomtomgroup.com/x/bpB_K and https://tttjira.ttg.global:8441/browse/DVSPRT","public":false,"type":"NORMAL"},"public":false}},"toRef":{"id":"refs/heads/master","displayId":"master","latestCommit":"ad359c8a9ba1eaf0bd2adec3aa37492c63966afb","repository":{"slug":"bitbucket-test","id":1960,"name":"bitbucket-test","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"DVSPRT","id":346,"name":"Development Support","description":"Everything related to development support, build system, development infrastructure. See https://confluence.tomtomgroup.com/x/bpB_K and https://tttjira.ttg.global:8441/browse/DVSPRT","public":false,"type":"NORMAL"},"public":false}},"locked":false,"author":{"user":{"name":"otherUserReplaced","emailAddress":"otherUserReplaced","id":11708,"displayName":"otherUserReplaced","active":true,"slug":"otherUserReplaced","type":"NORMAL"},"role":"AUTHOR","approved":false,"status":"UNAPPROVED"},"reviewers":[{"user":{"name":"authorUserReplaced","emailAddress":"authorReplaced","id":13761,"displayName":"authorReplaced","active":true,"slug":"authorUserReplaced","type":"NORMAL"},"lastReviewedCommit":"d5b55683288bc89c23609f3087a02b6daf7eef06","role":"REVIEWER","approved":true,"status":"APPROVED"}],"participants":[]},"participant":{"user":{"name":"authorUserReplaced","emailAddress":"authorReplaced","id":13761,"displayName":"authorReplaced","active":true,"slug":"authorUserReplaced","type":"NORMAL"},"lastReviewedCommit":"d5b55683288bc89c23609f3087a02b6daf7eef06","role":"REVIEWER","approved":true,"status":"APPROVED"},"previousStatus":"UNAPPROVED"}'{code}And has the same response that Bitbucket receive:{code:java}net.sf.json.JSONException: JSONObject["user"] not found. at net.sf.json.JSONObject.getString(JSONObject.java:2040) at com.cloudbees.jenkins.plugins.BitbucketPayloadProcessor.processPostServicePayload(BitbucketPayloadProcessor.java:128) at 

[JIRA] (JENKINS-53946) Bitbucket plugin unable to parse a Pull Request JSON Object

2018-10-08 Thread francisco.rodrig...@tomtom.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Francisco A. R. Vivas created an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-53946  
 
 
  Bitbucket plugin unable to parse a Pull Request JSON Object   
 

  
 
 
 
 

 
Issue Type: 
  Bug  
 
 
Assignee: 
 Unassigned  
 
 
Components: 
 bitbucket-plugin  
 
 
Created: 
 2018-10-08 15:24  
 
 
Priority: 
  Minor  
 
 
Reporter: 
 Francisco A. R. Vivas  
 

  
 
 
 
 

 
 I have created this issue after reading JENKINS-28877 and JENKINS-29096. Please, pay attention to the JSON provided as body for the CURL request to test its way of works.  I have configured a Webhook in Bitbucket Server 13.1 to be triggered by Approved event. I have received a HTTP 500 error, and get the same response with the next CURL code. Here is the error from Bitbucket UI: 

 

net.sf.json.JSONException: JSONObject["user"] not found.
	at net.sf.json.JSONObject.getString(JSONObject.java:2040)
	at com.cloudbees.jenkins.plugins.BitbucketPayloadProcessor.processPostServicePayload(BitbucketPayloadProcessor.java:128)
	at com.cloudbees.jenkins.plugins.BitbucketPayloadProcessor.processPayload(BitbucketPayloadProcessor.java:37)
	at com.cloudbees.jenkins.plugins.BitbucketHookReceiver.doIndex(BitbucketHookReceiver.java:54)
	at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
	at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
	at org.kohsuke.stapler.IndexDispatcher.dispatch(IndexDispatcher.java:26)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:734)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:864)
	at org.kohsuke.stapler.MetaClass$10.dispatch(MetaClass.java:374)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:734)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:864)
	at 

[JIRA] (JENKINS-28877) Bitbucket Plugin unable to parse Bitbucket webhook response json

2018-10-08 Thread francisco.rodrig...@tomtom.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Francisco A. R. Vivas commented on  JENKINS-28877  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Bitbucket Plugin unable to parse Bitbucket webhook response json   
 

  
 
 
 
 

 
 K C, I have the same problem with "Approved" pull request event option. As far as I can see here is where Jenkins Bitbucket Plugin fails: https://github.com/jenkinsci/bitbucket-plugin/blob/ce068b7f2cbf5250aa6d54c3acdd455d45b56246/src/main/java/com/cloudbees/jenkins/plugins/BitbucketPayloadProcessor.java#L24 I have captured the request and repeated here as a curl: 

 

curl -X POST \
  http://ttbsbld102.dev.ttw:8080/bitbucket-hook/ \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -H 'Postman-Token: 3d72a314-48e1-45ff-832a-950d43a7435d' \
  -H 'X-Event-Key: pr:reviewer:approved' \
  -H 'X-Request-Id: 0d6f5c89-f29b-4c8a-9fc4-a6fd1846bafb' \
  -d '{"eventKey":"pr:reviewer:approved","date":"2018-10-08T14:29:51+0200","actor":{"name":"authorUserReplaced","emailAddress":"authorReplaced","id":13761,"displayName":"authorReplaced","active":true,"slug":"authorUserReplaced","type":"NORMAL"},"pullRequest":{"id":2,"version":5,"title":"test edited online with Bitbucket","description":"abaöldflj","state":"OPEN","open":true,"closed":false,"createdDate":1538055333000,"updatedDate":153809000,"fromRef":{"id":"refs/heads/feature/checkitagain","displayId":"feature/checkitagain","latestCommit":"d5b55683288bc89c23609f3087a02b6daf7eef06","repository":{"slug":"bitbucket-test","id":1960,"name":"bitbucket-test","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"DVSPRT","id":346,"name":"Development Support","description":"Everything related to development support, build system, development infrastructure. See https://confluence.tomtomgroup.com/x/bpB_K and https://tttjira.ttg.global:8441/browse/DVSPRT","public":false,"type":"NORMAL"},"public":false}},"toRef":{"id":"refs/heads/master","displayId":"master","latestCommit":"ad359c8a9ba1eaf0bd2adec3aa37492c63966afb","repository":{"slug":"bitbucket-test","id":1960,"name":"bitbucket-test","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"DVSPRT","id":346,"name":"Development Support","description":"Everything related to development support, build system, development infrastructure. See https://confluence.tomtomgroup.com/x/bpB_K and https://tttjira.ttg.global:8441/browse/DVSPRT","public":false,"type":"NORMAL"},"public":false}},"locked":false,"author":{"user":{"name":"otherUserReplaced","emailAddress":"otherUserReplaced","id":11708,"displayName":"otherUserReplaced","active":true,"slug":"otherUserReplaced","type":"NORMAL"},"role":"AUTHOR","approved":false,"status":"UNAPPROVED"},"reviewers":[{"user":{"name":"authorUserReplaced","emailAddress":"authorReplaced","id":13761,"displayName":"authorReplaced","active":true,"slug":"authorUserReplaced","type":"NORMAL"},"lastReviewedCommit":"d5b55683288bc89c23609f3087a02b6daf7eef06","role":"REVIEWER","approved":true,"status":"APPROVED"}],"participants":[]},"participant":{"user":{"name":"authorUserReplaced","emailAddress":"authorReplaced","id":13761,"displayName":"authorReplaced","active":true,"slug":"authorUserReplaced","type":"NORMAL"},"lastReviewedCommit":"d5b55683288bc89c23609f3087a02b6daf7eef06","role":"REVIEWER","approved":true,"status":"APPROVED"},"previousStatus":"UNAPPROVED"}'
 

 And has the same response