[JENKINS-76244] Ignore Controller Proxy for Git CLI on Agents #1732
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.
We have a network setup where the controller needs to use one proxy while the agents needs to use another. We want to be able to set this via
http_proxy/https_proxyenvironment variables.At the moment this plugin unconditionally sets proxy environment variables for the Git CLI based on the proxy configuration on the controller.
I couldn't find documentation on whether the controller proxy configuration is intended to apply to agents as well. Looking at the Jenkins source code, the proxy configuration is only returned if running on the controller itself. It's being applied to this plugin due to the remoting architecture and what gets run on the controller vs the agent.
Thus this PR modifies the code to no longer set the proxy on agents, with a Java property added to revert to the previous behavior.
I believe this only effects the git CLI implementation (CGIt) as the JGit implementation does no have explicit code to handle the proxy set.
Opening this as a draft initially to get feedback as to if this is the best decision.
Fixes jenkinsci/github-branch-source-plugin#1483 (which was opened against the incorrect plugin).
TODO:
[ ] Add Automated Tets
[ ] Add fallback Java property to plugin documentation
Testing done
Submitter checklist