Modifying callable to have proxy information #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes an issue where the Callable cannot look up http proxy details from jenkins to download the latest script when the job is running on an agent. This is because the download utility (DetectDownloadManager) uses the JenkinsProxyHelper utility which uses Jenkins.getInstanceOrNull() which will fail if not run on jenkins master. In line with the docs for this method (https://javadoc.jenkins-ci.org/jenkins/model/Jenkins.html#getInstanceOrNull--) the plugin should ensure that the Callable has all the things it needs when it is sent over the remoting channel so that it does not need to refer to Jenkins. I have modified the code to take the proxy info and store it in the Callable. This depends on a separate pull request to integration-rest (blackducksoftware/integration-rest#14) to make ProxyInfo and Credentials serializable (which simply involves adding that interface to them both).
Open to ideas on different approaches - a possible extension could be to have environment variable(s) to set specific proxy details on a given agent.
Have tested on our jenkins setup and it is now able to use the proxy details to download the latest script when running on our agent where previously the download failed.