On Wednesday, October 24, 2012 8:22:46 AM UTC-6, Francesco Callari wrote:
>
> Responding to myself, I found the cause of the problem - here it is for 
> public consumption.
>
> The Notification Plugin <https://github.com/jenkinsci/notification-plugin> 
> uses 
> the java 
> HttpUrlConnection<http://docs.oracle.com/javase/1.5.0/docs/api/java/net/HttpURLConnection.html>
>  to 
> perform an HTTP notification. The relevant code is 
> here<https://github.com/jenkinsci/notification-plugin/blob/master/src/main/java/com/tikal/hudson/plugins/notification/Protocol.java#L87>:
>  
> note that the connection object is not set to follow redirects. The obvious 
> fix is to add a line there saying "connection.
> instanceFollowRedirects(true);"
>
> Does anyone know how to contact the upstream authors of the plugin?
>

I've got a pull request 
here:https://github.com/jenkinsci/notification-plugin/pull/4 with a full 
fix + unit test.
I'd also like to know about contacting authors / proper procedure for 
getting a patch accepted.


> Thanks
> Franco
>
> On Tuesday, October 23, 2012 11:22:21 PM UTC-4, Francesco Callari wrote:
>>
>> Hello Jenkin-users,
>>
>> I am having an issue with a Jenkins CI configuration where a notification 
>> of build completion is sent to an external servlet that will perform 
>> additional (large) integration tests on the artifact produced by the 
>> build. The notification is sent using the HTTP method (i.e. POST sending a 
>> json struct with build status information).
>>
>> My problem is that the servlet's location (DNS and IP) cannot be fixed 
>> (it's randomly scheduled in a cluster), and so it needs to be found using a 
>> name service that returns a standard HTTP redirect.
>>
>> However, the Jenkins HTTP client doesn't seem to follow the redirect. If 
>> I plug (in the Jenkins project configuration) the temporary address of the 
>> servlet endpoint to notify, all goes fine, but when I put the corresponding 
>> address of the same endpoint at the redirect service, nothing reaches the 
>> servlet. However, I have verified with curl that the redirect service is 
>> working correctly.
>>
>> In other words, this works (hostnames edited for security reasons):
>>
>> *bash$ export HOSTPORT="
>> http://redirect_service.example.com/redirect/my_servlet";; \* 
>>
>> *curl -L -v -H "Content-Type: application/json" -X POST -d \* 
>>
>> *'{"name":"my_project","url":"job/my_project/","build":'\* 
>>
>> *'{"full_url":"http://ci.example.com/job/my_project/8409/
>> ","number":8409,'\* 
>>
>> *'"phase":"FINISHED","status":"SUCCESS","url":"job/my_project/8409/"}}' 
>> ${HOSTPORT}/notify_build*
>>
>>
>> But specifying "*
>> http://redirect_service.example.com/redirect/my_servlet/notify_build"; *as 
>> the HTTP notification endpoint in the Jenkins configuration page for the 
>> project does not - the notification does not get through.
>>
>> Is this a known problem/bug?
>>
>> Thanks
>> Franco
>>
>>
>>

Reply via email to