How to disable the proxy setting in Jenkins for a

2019-07-31 20:29发布

We have our build nodes behind a corporate firewall and allow it out via a proxy to get stuff. So we have the proxy info set in the plugin manager.

However, I'd like to use AWS machines to do some building, but of course those don't need a proxy. I can't turn the proxy completely off or the other builds will break.

Is there a way to turn off or override the globally set proxy on a specific build?

Cloning the remote Git repository
Cloning repository https://joeuser@bitbucket.org/team/app.git
 > /usr/bin/git init /home/jenkins/workspace/Angular Projects/app/building-svcs-aws2 # timeout=10
Fetching upstream changes from https://joeuser@bitbucket.org/team/app.git
 > /usr/bin/git --version # timeout=10
using .gitcredentials to set credentials
 > /usr/bin/git config --local credential.username joeuser # timeout=10
 > /usr/bin/git config --local credential.helper store --file=/tmp/git7307041699576258044.credentials # timeout=10
Setting http proxy: proxyna.server.com:8060
 > /usr/bin/git -c core.askpass=true fetch --tags --progress https://joeuser@bitbucket.org/team/app.git +refs/heads/*:refs/remotes/origin/*
 > /usr/bin/git config --local --remove-section credential # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "/usr/bin/git -c core.askpass=true fetch --tags --progress https://joeuser@bitbucket.org/team/app.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:

You can see it injecting the proxy, I was surprised to find it get set there automatically from where it was configured in the plugins section. But if I remove the proxy setting there, the code checks out just fine.

I was going to move to ssh:// but I'll still have the problem I think with npm, maven, etc. ...

标签: jenkins proxy
1条回答
神经病院院长
2楼-- · 2019-07-31 20:46

This (kind of unexpected) behavior is currently discussed in Jenkins issue 31464.

The solution proposed there is that node-specific proxy settings will take precedence over the global proxy definition. I'd assume that also the EnvInject plugin could be used to change the proxy setting within a job then.

That solution has not been released yet, though. Possible work-arounds for the time being:

  • in the global proxy config, set the "No proxy host" exception for all your git servers, or
  • disable the global proxy config, and only re-enable it (manually) when you need to contact the update center, or
  • explicitly run the git command in your job (but this will only cover the most simple use cases).
查看更多
登录 后发表回答