mirror of
https://github.com/actions/runner.git
synced 2026-01-03 16:44:47 +08:00
Add Proxy Support for self-hosted runner. (#206)
This commit is contained in:
@@ -616,29 +616,6 @@ namespace GitHub.Runner.Worker
|
||||
|
||||
// PostJobSteps for job ExecutionContext
|
||||
PostJobSteps = new Stack<IStep>();
|
||||
// Proxy variables
|
||||
// var agentWebProxy = HostContext.GetService<IRunnerWebProxy>();
|
||||
// if (!string.IsNullOrEmpty(agentWebProxy.ProxyAddress))
|
||||
// {
|
||||
// SetRunnerContext("proxyurl", agentWebProxy.ProxyAddress);
|
||||
|
||||
// if (!string.IsNullOrEmpty(agentWebProxy.ProxyUsername))
|
||||
// {
|
||||
// SetRunnerContext("proxyusername", agentWebProxy.ProxyUsername);
|
||||
// }
|
||||
|
||||
// if (!string.IsNullOrEmpty(agentWebProxy.ProxyPassword))
|
||||
// {
|
||||
// HostContext.SecretMasker.AddValue(agentWebProxy.ProxyPassword);
|
||||
// SetRunnerContext("proxypassword", agentWebProxy.ProxyPassword);
|
||||
// }
|
||||
|
||||
// if (agentWebProxy.ProxyBypassList.Count > 0)
|
||||
// {
|
||||
// SetRunnerContext("proxybypasslist", JsonUtility.ToString(agentWebProxy.ProxyBypassList));
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Certificate variables
|
||||
// var agentCert = HostContext.GetService<IRunnerCertificateManager>();
|
||||
// if (agentCert.SkipServerCertificateValidation)
|
||||
|
||||
@@ -55,10 +55,13 @@ namespace GitHub.Runner.Worker
|
||||
context.Debug($"Primary repository: {repoFullName}");
|
||||
|
||||
// Print proxy setting information for better diagnostic experience
|
||||
var runnerWebProxy = HostContext.GetService<IRunnerWebProxy>();
|
||||
if (!string.IsNullOrEmpty(runnerWebProxy.ProxyAddress))
|
||||
if (!string.IsNullOrEmpty(HostContext.WebProxy.HttpProxyAddress))
|
||||
{
|
||||
context.Output($"Runner is running behind proxy server: '{runnerWebProxy.ProxyAddress}'");
|
||||
context.Output($"Runner is running behind proxy server '{HostContext.WebProxy.HttpProxyAddress}' for all HTTP requests.");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(HostContext.WebProxy.HttpsProxyAddress))
|
||||
{
|
||||
context.Output($"Runner is running behind proxy server '{HostContext.WebProxy.HttpsProxyAddress}' for all HTTPS requests.");
|
||||
}
|
||||
|
||||
// Prepare the workflow directory
|
||||
|
||||
@@ -40,9 +40,8 @@ namespace GitHub.Runner.Worker
|
||||
// Validate args.
|
||||
ArgUtil.NotNullOrEmpty(pipeIn, nameof(pipeIn));
|
||||
ArgUtil.NotNullOrEmpty(pipeOut, nameof(pipeOut));
|
||||
var runnerWebProxy = HostContext.GetService<IRunnerWebProxy>();
|
||||
var runnerCertManager = HostContext.GetService<IRunnerCertificateManager>();
|
||||
VssUtil.InitializeVssClientSettings(HostContext.UserAgent, runnerWebProxy.WebProxy, runnerCertManager.VssClientCertificateManager);
|
||||
VssUtil.InitializeVssClientSettings(HostContext.UserAgent, HostContext.WebProxy, runnerCertManager.VssClientCertificateManager);
|
||||
var jobRunner = HostContext.CreateService<IJobRunner>();
|
||||
|
||||
using (var channel = HostContext.CreateService<IProcessChannel>())
|
||||
|
||||
Reference in New Issue
Block a user