如何在Jenkins中为单个构建禁用代理设置

时间:2016-08-03 19:34:15

标签: jenkins proxy

我们在公司防火墙后面有我们的构建节点,并通过代理允许它来获取东西。所以我们在插件管理器中设置了代理信息。

但是,我想使用AWS机器进行构建,但当然那些不需要代理。我无法完全关闭代理或其他构建将中断。

有没有办法在特定版本上关闭或覆盖全局设置代理?

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:

你可以看到它注入代理,我很惊讶地发现它自动设置在插件部分中的配置位置。但是如果我在那里删除代理设置,代码检查就好了。

我打算转到ssh://但我仍然会遇到npmmaven等问题。

1 个答案:

答案 0 :(得分:2)

Jenkins issue 31464目前讨论了这种(一种意外的)行为。

提出的解决方案是,特定于节点的代理设置将优先于全局代理定义。我假设EnvInject插件也可用于更改作业中的代理设置。

该解决方案尚未发布可能的解决方法暂时:

  • 在全局代理配置中,设置"无代理主机"所有git服务器的异常,或
  • 禁用全局代理配置,仅在需要联系更新中心时重新启用(手动),或
  • 在您的作业中明确运行git命令(但这只会涵盖最简单的用例)。