Closed fedecz closed 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
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
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 ?
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:
- migrate to HttpClient 4.x to support java properties
- un-comment the proxy configuration in getHttpClient() https://github.com/nemccarthy/stash-pullrequest-builder-plugin/blob/048c7109918d8eb73a4624f6ced7970e3c4a55f2/src/main/java/stashpullrequestbuilder/stashpullrequestbuilder/stash/StashApiClient.java#L184 (This works like a charm except that non proxy hosts are not taken into account, which may be an issue for people who need the proxy to download plugins for instance but not to access stash)
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
Ok great! Do you plan to do it in a near future or do you need help on this one?
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?
Ok I can have a look at this during the next week. I can test against a Stash v4.0.4.
Hi there, is there a way con configure that? Is it using the proxy set in Jenkins? Thanks!
Fede