nemccarthy / stash-pullrequest-builder-plugin

A Jenkins plugin for Building Stash Pull Requests
https://wiki.jenkins-ci.org/display/JENKINS/Stash+pullrequest+builder+plugin
Other
64 stars 130 forks source link

Connecting to Stash through Proxy #65

Closed fedecz closed 8 years ago

fedecz commented 8 years ago

Hi there, is there a way con configure that? Is it using the proxy set in Jenkins? Thanks!

Fede

nemccarthy commented 8 years ago

It should use the proxy that the JVM is set to use. On a nix system if you set HTTP_PROXY & HTTPS_PROXY & NO_PROXY

iandyh commented 8 years ago

Hi @nemccarthy Somehow I cannot make the plugin works with proxy. After setting the JVM proxy, the plugin still cannot fetch the PRs. I checked the source code (https://github.com/nemccarthy/stash-pullrequest-builder-plugin/blob/master/src/main/java/stashpullrequestbuilder/stashpullrequestbuilder/stash/StashApiClient.java#L146) and it seems it directly creates an HttpClient and ignore the proxy setting at jenkins level. I am not a Java expert, it looks like you need to explicitly set the proxy at the client, reference: https://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientExecuteProxy.java

loicalbertin commented 8 years ago

Hi @nemccarthy , HttpClient doesn't honor environment variables. Starting with HttpClient 4.2 java net properties (http.proxyHost & http.proxyPort) are taken into account when using the HttpClientBuilder.

There is two options:

WDYT ?

nemccarthy commented 8 years ago

I'd vote for updating httpclient.

On Friday, 14 October 2016, Loïc Albertin notifications@github.com wrote:

Hi @nemccarthy https://github.com/nemccarthy , HttpClient doesn't honor environment variables. Starting with HttpClient 4.2 java net properties (http.proxyHost & http.proxyPort) are taken into account when using the HttpClientBuilder http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/client/HttpClientBuilder.html.

There is two options:

WDYT ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nemccarthy/stash-pullrequest-builder-plugin/issues/65#issuecomment-253508668, or mute the thread https://github.com/notifications/unsubscribe-auth/AHrBJJYaRIJYzXovl6friXp0JK-eWpYEks5qzi4hgaJpZM4GxfP5 .

Cheers,

NW

loicalbertin commented 8 years ago

Ok great! Do you plan to do it in a near future or do you need help on this one?

nemccarthy commented 8 years ago

Some help on this one would be great, thanks! On Fri, Oct 14, 2016 at 12:38 AM, Loïc Albertin notifications@github.com wrote:

Ok great! Do you plan to do it in a near future or do you need help on this one?

loicalbertin commented 8 years ago

Ok I can have a look at this during the next week. I can test against a Stash v4.0.4.