Skip to content

Conversation

@grochoge
Copy link

@grochoge grochoge commented Jan 7, 2026

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_proxy environment 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

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@MarkEWaite
Copy link
Contributor

MarkEWaite commented Jan 7, 2026

Opening this as a draft initially to get feedback as to if this is the best decision.

I won't accept this change because it changes the default behavior. That will break some portion of Jenkins users that depend on the default behavior without realizing that is changing.

In cases like this, the user should take full control of the git operations by using withCredentials to wrap calls to command line git. That allows you to define exactly the arguments you want for command line git and gives you full control of the entire process.

More details on that technique are available in the git plugin documentation.

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.

[JENKINS-76244] Different Proxy Configuration Between Controller and Agent

2 participants