Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-6933] Handle proxy settings #72

Merged
merged 16 commits into from
Feb 26, 2016
Merged

Conversation

olivierdagenais
Copy link
Member

Background

This feature was originally submitted as pull request #66 and this branch improves upon the work by pulling the proxy configuration from Jenkins itself, adding tests and contributing a small fix to the polling feature, discovered while testing.

Documentation

Here are the related changes submitted to document this new feature:

  1. Fix proxy server name documentation jenkins#2060
  2. Commit c04ea33 in the documentation_4.1.0 branch
  3. A proposed change to the JenkinsBehindProxy wiki page

Manual testing

  1. Set up a proxy server on the LAN.
    1. In my case, I installed Polipo on my Jenkins master. It's listening on all interfaces at port 8123.
  2. Upload private build of TFS plugin HPI to the Jenkins master via /jenkins/pluginManager/advanced, Prepare for Shutdown via /jenkins/quietDown then restart Jenkins.
  3. Configure one of the Jenkins agents to be unable to reach websites without going through a proxy server.
    1. In my case, it's an Ubuntu Linux 14.04 LTS VM for which I blanked out the 003 Router (gateway) option in its DHCP reservation. wget was unable to fetch anything ("No route to host.") until I [temporarily] set the http_proxy environment variable.
  4. Create a Jenkins job to use the "Team Foundation Server" SCM with a URL that's not on the LAN and then "pin" the job to the aforementioned agent.
    1. In my case, I used a free Visual Studio Team Services account that already had some TFVC repositories.
  5. Launch the job in Jenkins, wait for the TFS SDK to time out in its attempts to connect (about 90 seconds due to the retries with exponential backoff) and then fail with the build with "No route to host".
  6. Go to /jenkins/pluginManager/advanced to configure the proxy server in Jenkins.
  7. Launch the job again and watch as the source code is downloaded.

Mission accomplished!

Oli Dagenais and others added 16 commits February 23, 2016 09:40
Subclasses of AbstractCallableCommand will need access to the
WebProxySettings to relay to the Server instances they create.
These accept an optional ProxyHost instance to configure HttpClient
instances with the appropriate web proxy settings.
If a proxy server has been configured in Jenkins
and the TFS/VSTS server is not an excluded host,
the ModernConnectionAdvisor and ModernHTTPClientFactory
will make sure the HttpClient instances are configured appropriately.
This proxy server is scoped to "test"
This will make it possible to verify that the proxy server was used.
AbsractProject#poll() (in version 1.448) would only try to catch
AbortException, IOException and InterruptedException.
It may be worth expanding the reach of the try..catch in
compareRemoteRevisionWith() to catch any other programming error to make
them more visible without risking breaking polling on a Jenkins server.
As the name implies, this verifies that the TFS plugin will use the
proxy server configured in Jenkins itself.
Notice that the test set-up is able to proceed without going through the
web proxy, which reduces the chance of interference between tests.
@mosabua
Copy link
Member

mosabua commented Feb 24, 2016

Replaces #66

@mosabua
Copy link
Member

mosabua commented Feb 24, 2016

@jenkinsadmin
Copy link
Member

Thank you for this pull request! Please check this document for how the Jenkins project handles pull requests.

@ytterx
Copy link

ytterx commented Feb 26, 2016

This fix builds upon my changes, and I have verified that it still works. Getting the proxy configuration by asking Jenkins itself deals with a small annoyance we still had by having to have a correct environment when starting a slave.

olivierdagenais added a commit that referenced this pull request Feb 26, 2016
[JENKINS-6933] Handle proxy settings
@olivierdagenais olivierdagenais merged commit 2fb1175 into master Feb 26, 2016
@olivierdagenais
Copy link
Member Author

Thank you, @ytterx! We couldn't have done it without you.!

@olivierdagenais olivierdagenais deleted the handle_proxy_settings branch February 26, 2016 14:08
olivierdagenais pushed a commit that referenced this pull request Feb 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants