mirror of
https://github.com/actions/runner.git
synced 2025-12-13 00:36:29 +00:00
Set both http_proxy and HTTP_PROXY env for runner/worker processes. (#298)
This commit is contained in:
@@ -73,6 +73,10 @@ namespace GitHub.Runner.Sdk
|
|||||||
{
|
{
|
||||||
_httpProxyAddress = proxyHttpUri.AbsoluteUri;
|
_httpProxyAddress = proxyHttpUri.AbsoluteUri;
|
||||||
|
|
||||||
|
// Set both environment variables since there are tools support both casing (curl, wget) and tools support only one casing (docker)
|
||||||
|
Environment.SetEnvironmentVariable("HTTP_PROXY", _httpProxyAddress);
|
||||||
|
Environment.SetEnvironmentVariable("http_proxy", _httpProxyAddress);
|
||||||
|
|
||||||
// the proxy url looks like http://[user:pass@]127.0.0.1:8888
|
// the proxy url looks like http://[user:pass@]127.0.0.1:8888
|
||||||
var userInfo = Uri.UnescapeDataString(proxyHttpUri.UserInfo).Split(':', 2, StringSplitOptions.RemoveEmptyEntries);
|
var userInfo = Uri.UnescapeDataString(proxyHttpUri.UserInfo).Split(':', 2, StringSplitOptions.RemoveEmptyEntries);
|
||||||
if (userInfo.Length == 2)
|
if (userInfo.Length == 2)
|
||||||
@@ -99,6 +103,10 @@ namespace GitHub.Runner.Sdk
|
|||||||
{
|
{
|
||||||
_httpsProxyAddress = proxyHttpsUri.AbsoluteUri;
|
_httpsProxyAddress = proxyHttpsUri.AbsoluteUri;
|
||||||
|
|
||||||
|
// Set both environment variables since there are tools support both casing (curl, wget) and tools support only one casing (docker)
|
||||||
|
Environment.SetEnvironmentVariable("HTTPS_PROXY", _httpsProxyAddress);
|
||||||
|
Environment.SetEnvironmentVariable("https_proxy", _httpsProxyAddress);
|
||||||
|
|
||||||
// the proxy url looks like http://[user:pass@]127.0.0.1:8888
|
// the proxy url looks like http://[user:pass@]127.0.0.1:8888
|
||||||
var userInfo = Uri.UnescapeDataString(proxyHttpsUri.UserInfo).Split(':', 2, StringSplitOptions.RemoveEmptyEntries);
|
var userInfo = Uri.UnescapeDataString(proxyHttpsUri.UserInfo).Split(':', 2, StringSplitOptions.RemoveEmptyEntries);
|
||||||
if (userInfo.Length == 2)
|
if (userInfo.Length == 2)
|
||||||
@@ -124,6 +132,11 @@ namespace GitHub.Runner.Sdk
|
|||||||
if (!string.IsNullOrEmpty(noProxyList))
|
if (!string.IsNullOrEmpty(noProxyList))
|
||||||
{
|
{
|
||||||
_noProxyString = noProxyList;
|
_noProxyString = noProxyList;
|
||||||
|
|
||||||
|
// Set both environment variables since there are tools support both casing (curl, wget) and tools support only one casing (docker)
|
||||||
|
Environment.SetEnvironmentVariable("NO_PROXY", noProxyList);
|
||||||
|
Environment.SetEnvironmentVariable("no_proxy", noProxyList);
|
||||||
|
|
||||||
var noProxyListSplit = noProxyList.Split(',', StringSplitOptions.RemoveEmptyEntries);
|
var noProxyListSplit = noProxyList.Split(',', StringSplitOptions.RemoveEmptyEntries);
|
||||||
foreach (string noProxy in noProxyListSplit)
|
foreach (string noProxy in noProxyListSplit)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user