mirror of
https://github.com/actions/runner.git
synced 2025-12-12 15:13:30 +00:00
Compare commits
1 Commits
test
...
users/tihu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4407901087 |
@@ -15,7 +15,7 @@ Make sure the runner has access to actions service for GitHub.com or GitHub Ente
|
|||||||
```
|
```
|
||||||
curl -v https://api.github.com/api/v3/zen
|
curl -v https://api.github.com/api/v3/zen
|
||||||
curl -v https://vstoken.actions.githubusercontent.com/_apis/health
|
curl -v https://vstoken.actions.githubusercontent.com/_apis/health
|
||||||
curl -v https://pipelines.actions.githubusercontent.com/_apis/health
|
curl -v https://pipelines.actions.githubusercontent/_apis/health
|
||||||
```
|
```
|
||||||
|
|
||||||
- For GitHub Enterprise Server
|
- For GitHub Enterprise Server
|
||||||
|
|||||||
@@ -20,30 +20,11 @@ The test also set environment variable `GIT_TRACE=1` and `GIT_CURL_VERBOSE=1` be
|
|||||||
|
|
||||||
## How to fix the issue?
|
## How to fix the issue?
|
||||||
|
|
||||||
### 1. Check global and system git config
|
### 1. Check the common network issue
|
||||||
|
|
||||||
If you are having issues connecting to the server, check your global and system git config for any unexpected authentication headers. You might be seeing an error like:
|
|
||||||
|
|
||||||
```
|
|
||||||
fatal: unable to access 'https://github.com/actions/checkout/': The requested URL returned error: 400
|
|
||||||
```
|
|
||||||
|
|
||||||
The following commands can be used to check for unexpected authentication headers:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ git config --global --list | grep extraheader
|
|
||||||
http.extraheader=AUTHORIZATION: unexpected_auth_header
|
|
||||||
|
|
||||||
$ git config --system --list | grep extraheader
|
|
||||||
```
|
|
||||||
|
|
||||||
The following command can be used to remove the above value: `git config --global --unset http.extraheader`
|
|
||||||
|
|
||||||
### 2. Check the common network issue
|
|
||||||
|
|
||||||
> Please check the [network doc](./network.md)
|
> Please check the [network doc](./network.md)
|
||||||
|
|
||||||
### 3. SSL certificate related issue
|
### 2. SSL certificate related issue
|
||||||
|
|
||||||
If you are seeing `SSL Certificate problem:` in the log, it means the `git` can't connect to the GitHub server due to SSL handshake failure.
|
If you are seeing `SSL Certificate problem:` in the log, it means the `git` can't connect to the GitHub server due to SSL handshake failure.
|
||||||
> Please check the [SSL cert doc](./sslcert.md)
|
> Please check the [SSL cert doc](./sslcert.md)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ The `installdependencies.sh` script should install all required dependencies on
|
|||||||
|
|
||||||
Debian based OS (Debian, Ubuntu, Linux Mint)
|
Debian based OS (Debian, Ubuntu, Linux Mint)
|
||||||
|
|
||||||
- liblttng-ust1 or liblttng-ust0
|
- liblttng-ust0
|
||||||
- libkrb5-3
|
- libkrb5-3
|
||||||
- zlib1g
|
- zlib1g
|
||||||
- libssl1.1, libssl1.0.2 or libssl1.0.0
|
- libssl1.1, libssl1.0.2 or libssl1.0.0
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
## Features
|
## Features
|
||||||
- Added support for a JIT runner config (#1925)
|
- Allow self-hosted runner admins to fail jobs that don't have a job container (#1895)
|
||||||
- Added `ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION` env option to force actions to run on a specific node version (#1913)
|
- Experimental: Self-hosted runner admins can now use scripts to customize the container invocation in the runner (#1853)
|
||||||
## Bugs
|
## Bugs
|
||||||
- Fixed a bug where container hooks passed in path as a string rather then an array of strings (#1948)
|
- Fixed an issue where a Job Hook would fail to execute if the shell path contains a space on Windows (#1826)
|
||||||
|
|
||||||
## Misc
|
## Misc
|
||||||
- Minor cleanup of error messages when running container hooks (#1949)
|
- Handle new `HostedRunnerShutdownMessage` to shutdown hosted runners faster (#1922)
|
||||||
|
|
||||||
## Windows x64
|
## Windows x64
|
||||||
We recommend configuring the runner in a root folder of the Windows drive (e.g. "C:\actions-runner"). This will help avoid issues related to service identity folder permissions and long file path restrictions on Windows.
|
We recommend configuring the runner in a root folder of the Windows drive (e.g. "C:\actions-runner"). This will help avoid issues related to service identity folder permissions and long file path restrictions on Windows.
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$apt_get update && $apt_get install -y libkrb5-3 zlib1g
|
$apt_get update && $apt_get install -y liblttng-ust0 libkrb5-3 zlib1g
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
echo "'$apt_get' failed with exit code '$?'"
|
echo "'$apt_get' failed with exit code '$?'"
|
||||||
@@ -94,14 +94,6 @@ then
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
apt_get_with_fallbacks liblttng-ust1 liblttng-ust0
|
|
||||||
if [ $? -ne 0 ]
|
|
||||||
then
|
|
||||||
echo "'$apt_get' failed with exit code '$?'"
|
|
||||||
print_errormessage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
apt_get_with_fallbacks libssl1.1$ libssl1.0.2$ libssl1.0.0$
|
apt_get_with_fallbacks libssl1.1$ libssl1.0.2$ libssl1.0.0$
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ namespace GitHub.Runner.Common
|
|||||||
public static class Args
|
public static class Args
|
||||||
{
|
{
|
||||||
public static readonly string Auth = "auth";
|
public static readonly string Auth = "auth";
|
||||||
public static readonly string JitConfig = "jitconfig";
|
|
||||||
public static readonly string Labels = "labels";
|
public static readonly string Labels = "labels";
|
||||||
public static readonly string MonitorSocketAddress = "monitorsocketaddress";
|
public static readonly string MonitorSocketAddress = "monitorsocketaddress";
|
||||||
public static readonly string Name = "name";
|
public static readonly string Name = "name";
|
||||||
@@ -242,7 +241,6 @@ namespace GitHub.Runner.Common
|
|||||||
|
|
||||||
// Set this env var to "node12" to downgrade the node version for internal functions (e.g hashfiles). This does NOT affect the version of node actions.
|
// Set this env var to "node12" to downgrade the node version for internal functions (e.g hashfiles). This does NOT affect the version of node actions.
|
||||||
public static readonly string ForcedInternalNodeVersion = "ACTIONS_RUNNER_FORCED_INTERNAL_NODE_VERSION";
|
public static readonly string ForcedInternalNodeVersion = "ACTIONS_RUNNER_FORCED_INTERNAL_NODE_VERSION";
|
||||||
public static readonly string ForcedActionsNodeVersion = "ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class System
|
public static class System
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace GitHub.Runner.Common
|
|||||||
{
|
{
|
||||||
Task ConnectAsync(Uri serverUrl, VssCredentials credentials);
|
Task ConnectAsync(Uri serverUrl, VssCredentials credentials);
|
||||||
|
|
||||||
Task<AgentJobRequestMessage> GetJobMessageAsync(string id, CancellationToken token);
|
Task<AgentJobRequestMessage> GetJobMessageAsync(string id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class RunServer : RunnerService, IRunServer
|
public sealed class RunServer : RunnerService, IRunServer
|
||||||
@@ -67,40 +67,10 @@ namespace GitHub.Runner.Common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<AgentJobRequestMessage> GetJobMessageAsync(string id, CancellationToken cancellationToken)
|
public Task<AgentJobRequestMessage> GetJobMessageAsync(string id)
|
||||||
{
|
{
|
||||||
CheckConnection();
|
CheckConnection();
|
||||||
var jobMessage = RetryRequest<AgentJobRequestMessage>(async () =>
|
return _taskAgentClient.GetJobMessageAsync(id);
|
||||||
{
|
|
||||||
return await _taskAgentClient.GetJobMessageAsync(id, cancellationToken);
|
|
||||||
}, cancellationToken);
|
|
||||||
return jobMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<T> RetryRequest<T>(Func<Task<T>> func,
|
|
||||||
CancellationToken cancellationToken,
|
|
||||||
int maxRetryAttemptsCount = 5
|
|
||||||
)
|
|
||||||
{
|
|
||||||
var retryCount = 0;
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
retryCount++;
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return await func();
|
|
||||||
}
|
|
||||||
// TODO: Add handling of non-retriable exceptions: https://github.com/github/actions-broker/issues/122
|
|
||||||
catch (Exception ex) when (retryCount < maxRetryAttemptsCount)
|
|
||||||
{
|
|
||||||
Trace.Error("Catch exception during get full job message");
|
|
||||||
Trace.Error(ex);
|
|
||||||
var backOff = BackoffTimerHelper.GetRandomBackoff(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15));
|
|
||||||
Trace.Warning($"Back off {backOff.TotalSeconds} seconds before next retry. {maxRetryAttemptsCount - retryCount} attempt left.");
|
|
||||||
await Task.Delay(backOff, cancellationToken);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Win32.Registry" Version="4.4.0" />
|
<PackageReference Include="Microsoft.Win32.Registry" Version="4.4.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||||
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="4.4.0" />
|
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="4.4.0" />
|
||||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.4.0" />
|
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.4.0" />
|
||||||
<PackageReference Include="System.Threading.Channels" Version="4.4.0" />
|
<PackageReference Include="System.Threading.Channels" Version="4.4.0" />
|
||||||
|
|||||||
@@ -15,14 +15,8 @@ namespace GitHub.Runner.Common.Util
|
|||||||
|
|
||||||
public static string GetInternalNodeVersion()
|
public static string GetInternalNodeVersion()
|
||||||
{
|
{
|
||||||
var forcedInternalNodeVersion = Environment.GetEnvironmentVariable(Constants.Variables.Agent.ForcedInternalNodeVersion);
|
var forcedNodeVersion = Environment.GetEnvironmentVariable(Constants.Variables.Agent.ForcedInternalNodeVersion);
|
||||||
var isForcedInternalNodeVersion = !string.IsNullOrEmpty(forcedInternalNodeVersion) && BuiltInNodeVersions.Contains(forcedInternalNodeVersion);
|
return !string.IsNullOrEmpty(forcedNodeVersion) && BuiltInNodeVersions.Contains(forcedNodeVersion) ? forcedNodeVersion : _defaultNodeVersion;
|
||||||
|
|
||||||
if (isForcedInternalNodeVersion)
|
|
||||||
{
|
|
||||||
return forcedInternalNodeVersion;
|
|
||||||
}
|
|
||||||
return _defaultNodeVersion;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ namespace GitHub.Runner.Listener
|
|||||||
new string[]
|
new string[]
|
||||||
{
|
{
|
||||||
Constants.Runner.CommandLine.Flags.Once,
|
Constants.Runner.CommandLine.Flags.Once,
|
||||||
Constants.Runner.CommandLine.Args.JitConfig,
|
|
||||||
Constants.Runner.CommandLine.Args.StartupType
|
Constants.Runner.CommandLine.Args.StartupType
|
||||||
},
|
},
|
||||||
// valid warmup flags and args
|
// valid warmup flags and args
|
||||||
@@ -214,12 +213,6 @@ namespace GitHub.Runner.Listener
|
|||||||
validator: Validators.AuthSchemeValidator);
|
validator: Validators.AuthSchemeValidator);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetJitConfig()
|
|
||||||
{
|
|
||||||
return GetArg(
|
|
||||||
name: Constants.Runner.CommandLine.Args.JitConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetRunnerName()
|
public string GetRunnerName()
|
||||||
{
|
{
|
||||||
return GetArgOrPrompt(
|
return GetArgOrPrompt(
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Win32.Registry" Version="4.4.0" />
|
<PackageReference Include="Microsoft.Win32.Registry" Version="4.4.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||||
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="4.4.0" />
|
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="4.4.0" />
|
||||||
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="4.4.0" />
|
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="4.4.0" />
|
||||||
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.4.0" />
|
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.4.0" />
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using GitHub.DistributedTask.WebApi;
|
using GitHub.DistributedTask.WebApi;
|
||||||
@@ -194,30 +192,6 @@ namespace GitHub.Runner.Listener
|
|||||||
return Constants.Runner.ReturnCode.Success;
|
return Constants.Runner.ReturnCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var base64JitConfig = command.GetJitConfig();
|
|
||||||
if (!string.IsNullOrEmpty(base64JitConfig))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var decodedJitConfig = Encoding.UTF8.GetString(Convert.FromBase64String(base64JitConfig));
|
|
||||||
var jitConfig = StringUtil.ConvertFromJson<Dictionary<string, string>>(decodedJitConfig);
|
|
||||||
foreach (var config in jitConfig)
|
|
||||||
{
|
|
||||||
var configFile = Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Root), config.Key);
|
|
||||||
var configContent = Encoding.UTF8.GetString(Convert.FromBase64String(config.Value));
|
|
||||||
File.WriteAllText(configFile, configContent, Encoding.UTF8);
|
|
||||||
File.SetAttributes(configFile, File.GetAttributes(configFile) | FileAttributes.Hidden);
|
|
||||||
Trace.Info($"Save {configContent.Length} chars to '{configFile}'.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Trace.Error(ex);
|
|
||||||
_term.WriteError(ex.Message);
|
|
||||||
return Constants.Runner.ReturnCode.TerminatedError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RunnerSettings settings = configManager.LoadSettings();
|
RunnerSettings settings = configManager.LoadSettings();
|
||||||
|
|
||||||
var store = HostContext.GetService<IConfigurationStore>();
|
var store = HostContext.GetService<IConfigurationStore>();
|
||||||
@@ -500,9 +474,10 @@ namespace GitHub.Runner.Listener
|
|||||||
var credMgr = HostContext.GetService<ICredentialManager>();
|
var credMgr = HostContext.GetService<ICredentialManager>();
|
||||||
var creds = credMgr.LoadCredentials();
|
var creds = credMgr.LoadCredentials();
|
||||||
|
|
||||||
|
// todo: add retries https://github.com/github/actions-broker/issues/49
|
||||||
var runServer = HostContext.CreateService<IRunServer>();
|
var runServer = HostContext.CreateService<IRunServer>();
|
||||||
await runServer.ConnectAsync(new Uri(settings.ServerUrl), creds);
|
await runServer.ConnectAsync(new Uri(settings.ServerUrl), creds);
|
||||||
var jobMessage = await runServer.GetJobMessageAsync(messageRef.RunnerRequestId, messageQueueLoopTokenSource.Token);
|
var jobMessage = await runServer.GetJobMessageAsync(messageRef.RunnerRequestId);
|
||||||
|
|
||||||
jobDispatcher.Run(jobMessage, runOnce);
|
jobDispatcher.Run(jobMessage, runOnce);
|
||||||
if (runOnce)
|
if (runOnce)
|
||||||
@@ -627,7 +602,7 @@ Config Options:
|
|||||||
--labels string Extra labels in addition to the default: 'self-hosted,{Constants.Runner.Platform},{Constants.Runner.PlatformArchitecture}'
|
--labels string Extra labels in addition to the default: 'self-hosted,{Constants.Runner.Platform},{Constants.Runner.PlatformArchitecture}'
|
||||||
--work string Relative runner work directory (default {Constants.Path.WorkDirectory})
|
--work string Relative runner work directory (default {Constants.Path.WorkDirectory})
|
||||||
--replace Replace any existing runner with the same name (default false)
|
--replace Replace any existing runner with the same name (default false)
|
||||||
--pat GitHub personal access token with repo scope. Used for checking network connectivity when executing `.{separator}run.{ext} --check`
|
--pat GitHub personal access token used for checking network connectivity when executing `.{separator}run.{ext} --check`
|
||||||
--disableupdate Disable self-hosted runner automatic update to the latest released version`
|
--disableupdate Disable self-hosted runner automatic update to the latest released version`
|
||||||
--ephemeral Configure the runner to only take one job and then let the service un-configure the runner after the job finishes (default false)");
|
--ephemeral Configure the runner to only take one job and then let the service un-configure the runner after the job finishes (default false)");
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ namespace GitHub.Runner.Worker.Container.ContainerHooks
|
|||||||
EntryPointArgs = entryPointArgs.Split(' ').Select(arg => arg.Trim()),
|
EntryPointArgs = entryPointArgs.Split(' ').Select(arg => arg.Trim()),
|
||||||
EntryPoint = entryPoint,
|
EntryPoint = entryPoint,
|
||||||
EnvironmentVariables = environmentVariables,
|
EnvironmentVariables = environmentVariables,
|
||||||
PrependPath = context.Global.PrependPath.Reverse<string>(),
|
PrependPath = prependPath,
|
||||||
WorkingDirectory = workingDirectory,
|
WorkingDirectory = workingDirectory,
|
||||||
},
|
},
|
||||||
State = context.Global.ContainerHookState
|
State = context.Global.ContainerHookState
|
||||||
@@ -174,7 +174,8 @@ namespace GitHub.Runner.Worker.Container.ContainerHooks
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
throw new Exception($"Executing the custom container implementation failed. Please contact your self hosted runner administrator.", ex);
|
Trace.Error(ex);
|
||||||
|
throw new Exception($"Custom container implementation failed with error: {ex.Message} Please contact your self hosted runner administrator.", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace GitHub.Runner.Worker.Container.ContainerHooks
|
|||||||
public IEnumerable<string> EntryPointArgs { get; set; }
|
public IEnumerable<string> EntryPointArgs { get; set; }
|
||||||
public string EntryPoint { get; set; }
|
public string EntryPoint { get; set; }
|
||||||
public IDictionary<string, string> EnvironmentVariables { get; set; }
|
public IDictionary<string, string> EnvironmentVariables { get; set; }
|
||||||
public IEnumerable<string> PrependPath { get; set; }
|
public string PrependPath { get; set; }
|
||||||
public string WorkingDirectory { get; set; }
|
public string WorkingDirectory { get; set; }
|
||||||
public bool IsRequireAlpineInResponse() => false;
|
public bool IsRequireAlpineInResponse() => false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,8 +67,6 @@ namespace GitHub.Runner.Worker
|
|||||||
|
|
||||||
bool IsEmbedded { get; }
|
bool IsEmbedded { get; }
|
||||||
|
|
||||||
List<string> StepEnvironmentOverrides { get; }
|
|
||||||
|
|
||||||
ExecutionContext Root { get; }
|
ExecutionContext Root { get; }
|
||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
@@ -239,8 +237,6 @@ namespace GitHub.Runner.Worker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<string> StepEnvironmentOverrides { get; } = new List<string>();
|
|
||||||
|
|
||||||
public override void Initialize(IHostContext hostContext)
|
public override void Initialize(IHostContext hostContext)
|
||||||
{
|
{
|
||||||
base.Initialize(hostContext);
|
base.Initialize(hostContext);
|
||||||
@@ -739,12 +735,17 @@ namespace GitHub.Runner.Worker
|
|||||||
var base64EncodedToken = Convert.ToBase64String(Encoding.UTF8.GetBytes($"x-access-token:{githubAccessToken}"));
|
var base64EncodedToken = Convert.ToBase64String(Encoding.UTF8.GetBytes($"x-access-token:{githubAccessToken}"));
|
||||||
HostContext.SecretMasker.AddValue(base64EncodedToken);
|
HostContext.SecretMasker.AddValue(base64EncodedToken);
|
||||||
var githubJob = Global.Variables.Get("system.github.job");
|
var githubJob = Global.Variables.Get("system.github.job");
|
||||||
|
var githubJobId = Global.Variables.Get("system.github.jobId");
|
||||||
var githubContext = new GitHubContext();
|
var githubContext = new GitHubContext();
|
||||||
githubContext["token"] = githubAccessToken;
|
githubContext["token"] = githubAccessToken;
|
||||||
if (!string.IsNullOrEmpty(githubJob))
|
if (!string.IsNullOrEmpty(githubJob))
|
||||||
{
|
{
|
||||||
githubContext["job"] = new StringContextData(githubJob);
|
githubContext["job"] = new StringContextData(githubJob);
|
||||||
}
|
}
|
||||||
|
if (!string.IsNullOrEmpty(githubJobId))
|
||||||
|
{
|
||||||
|
githubContext["job_id"] = new StringContextData(githubJobId);
|
||||||
|
}
|
||||||
var githubDictionary = ExpressionValues["github"].AssertDictionary("github");
|
var githubDictionary = ExpressionValues["github"].AssertDictionary("github");
|
||||||
foreach (var pair in githubDictionary)
|
foreach (var pair in githubDictionary)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace GitHub.Runner.Worker
|
|||||||
"graphql_url",
|
"graphql_url",
|
||||||
"head_ref",
|
"head_ref",
|
||||||
"job",
|
"job",
|
||||||
|
"job_id",
|
||||||
"path",
|
"path",
|
||||||
"ref_name",
|
"ref_name",
|
||||||
"ref_protected",
|
"ref_protected",
|
||||||
|
|||||||
@@ -266,11 +266,7 @@ namespace GitHub.Runner.Worker.Handlers
|
|||||||
#endif
|
#endif
|
||||||
foreach (var pair in dict)
|
foreach (var pair in dict)
|
||||||
{
|
{
|
||||||
// Skip global env, otherwise we merge an outdated global env
|
envContext[pair.Key] = pair.Value;
|
||||||
if (ExecutionContext.StepEnvironmentOverrides.Contains(pair.Key))
|
|
||||||
{
|
|
||||||
envContext[pair.Key] = pair.Value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,13 +275,11 @@ namespace GitHub.Runner.Worker.Handlers
|
|||||||
if (step is IActionRunner actionStep)
|
if (step is IActionRunner actionStep)
|
||||||
{
|
{
|
||||||
// Evaluate and merge embedded-step env
|
// Evaluate and merge embedded-step env
|
||||||
step.ExecutionContext.StepEnvironmentOverrides.AddRange(ExecutionContext.StepEnvironmentOverrides);
|
|
||||||
var templateEvaluator = step.ExecutionContext.ToPipelineTemplateEvaluator();
|
var templateEvaluator = step.ExecutionContext.ToPipelineTemplateEvaluator();
|
||||||
var actionEnvironment = templateEvaluator.EvaluateStepEnvironment(actionStep.Action.Environment, step.ExecutionContext.ExpressionValues, step.ExecutionContext.ExpressionFunctions, Common.Util.VarUtil.EnvironmentVariableKeyComparer);
|
var actionEnvironment = templateEvaluator.EvaluateStepEnvironment(actionStep.Action.Environment, step.ExecutionContext.ExpressionValues, step.ExecutionContext.ExpressionFunctions, Common.Util.VarUtil.EnvironmentVariableKeyComparer);
|
||||||
foreach (var env in actionEnvironment)
|
foreach (var env in actionEnvironment)
|
||||||
{
|
{
|
||||||
envContext[env.Key] = new StringContextData(env.Value ?? string.Empty);
|
envContext[env.Key] = new StringContextData(env.Value ?? string.Empty);
|
||||||
step.ExecutionContext.StepEnvironmentOverrides.Add(env.Key);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ using GitHub.DistributedTask.Pipelines.ContextData;
|
|||||||
using GitHub.DistributedTask.WebApi;
|
using GitHub.DistributedTask.WebApi;
|
||||||
using GitHub.Runner.Common;
|
using GitHub.Runner.Common;
|
||||||
using GitHub.Runner.Sdk;
|
using GitHub.Runner.Sdk;
|
||||||
using GitHub.Runner.Common.Util;
|
|
||||||
using GitHub.Runner.Worker.Container;
|
using GitHub.Runner.Worker.Container;
|
||||||
using GitHub.Runner.Worker.Container.ContainerHooks;
|
using GitHub.Runner.Worker.Container.ContainerHooks;
|
||||||
|
|
||||||
@@ -105,12 +104,6 @@ namespace GitHub.Runner.Worker.Handlers
|
|||||||
Data.NodeVersion = "node16";
|
Data.NodeVersion = "node16";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
string forcedNodeVersion = System.Environment.GetEnvironmentVariable(Constants.Variables.Agent.ForcedActionsNodeVersion);
|
|
||||||
|
|
||||||
if (forcedNodeVersion == "node16" && Data.NodeVersion != "node16")
|
|
||||||
{
|
|
||||||
Data.NodeVersion = "node16";
|
|
||||||
}
|
|
||||||
var nodeRuntimeVersion = await StepHost.DetermineNodeRuntimeVersion(ExecutionContext, Data.NodeVersion);
|
var nodeRuntimeVersion = await StepHost.DetermineNodeRuntimeVersion(ExecutionContext, Data.NodeVersion);
|
||||||
string file = Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Externals), nodeRuntimeVersion, "bin", $"node{IOUtil.ExeExtension}");
|
string file = Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Externals), nodeRuntimeVersion, "bin", $"node{IOUtil.ExeExtension}");
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ namespace GitHub.Runner.Worker
|
|||||||
foreach (var env in actionEnvironment)
|
foreach (var env in actionEnvironment)
|
||||||
{
|
{
|
||||||
envContext[env.Key] = new StringContextData(env.Value ?? string.Empty);
|
envContext[env.Key] = new StringContextData(env.Value ?? string.Empty);
|
||||||
step.ExecutionContext.StepEnvironmentOverrides.Add(env.Key);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -351,18 +351,6 @@ namespace GitHub.Services.Common.Diagnostics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[NonEvent]
|
|
||||||
public void AuthenticationFailedOnFirstRequest(
|
|
||||||
VssTraceActivity activity,
|
|
||||||
HttpResponseMessage response)
|
|
||||||
{
|
|
||||||
if (IsEnabled())
|
|
||||||
{
|
|
||||||
SetActivityId(activity);
|
|
||||||
WriteMessageEvent((Int32)response.StatusCode, response.Headers.ToString(), this.AuthenticationFailedOnFirstRequest);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[NonEvent]
|
[NonEvent]
|
||||||
public void IssuedTokenProviderCreated(
|
public void IssuedTokenProviderCreated(
|
||||||
VssTraceActivity activity,
|
VssTraceActivity activity,
|
||||||
@@ -463,7 +451,7 @@ namespace GitHub.Services.Common.Diagnostics
|
|||||||
[NonEvent]
|
[NonEvent]
|
||||||
public void IssuedTokenInvalidated(
|
public void IssuedTokenInvalidated(
|
||||||
VssTraceActivity activity,
|
VssTraceActivity activity,
|
||||||
IssuedTokenProvider provider,
|
IssuedTokenProvider provider,
|
||||||
IssuedToken token)
|
IssuedToken token)
|
||||||
{
|
{
|
||||||
if (IsEnabled())
|
if (IsEnabled())
|
||||||
@@ -825,7 +813,7 @@ namespace GitHub.Services.Common.Diagnostics
|
|||||||
[Event(31, Keywords = Keywords.Authentication, Level = EventLevel.Warning, Task = Tasks.Authentication, Opcode = EventOpcode.Info, Message = "Retrieving an AAD auth token took a long time ({0} seconds)")]
|
[Event(31, Keywords = Keywords.Authentication, Level = EventLevel.Warning, Task = Tasks.Authentication, Opcode = EventOpcode.Info, Message = "Retrieving an AAD auth token took a long time ({0} seconds)")]
|
||||||
public void AuthorizationDelayed(string timespan)
|
public void AuthorizationDelayed(string timespan)
|
||||||
{
|
{
|
||||||
if (IsEnabled(EventLevel.Warning, Keywords.Authentication))
|
if(IsEnabled(EventLevel.Warning, Keywords.Authentication))
|
||||||
{
|
{
|
||||||
WriteEvent(31, timespan);
|
WriteEvent(31, timespan);
|
||||||
}
|
}
|
||||||
@@ -840,17 +828,6 @@ namespace GitHub.Services.Common.Diagnostics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Event(33, Keywords = Keywords.Authentication, Level = EventLevel.Verbose, Task = Tasks.HttpRequest, Message = "Authentication failed on first request with status code {0}.%n{1}")]
|
|
||||||
private void AuthenticationFailedOnFirstRequest(
|
|
||||||
Int32 statusCode,
|
|
||||||
String headers)
|
|
||||||
{
|
|
||||||
if (IsEnabled(EventLevel.Verbose, Keywords.Authentication))
|
|
||||||
{
|
|
||||||
WriteEvent(33, statusCode, headers);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the activity ID of the current thread.
|
/// Sets the activity ID of the current thread.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -251,14 +251,7 @@ namespace GitHub.Services.Common
|
|||||||
|
|
||||||
// Invalidate the token and ensure that we have the correct token provider for the challenge
|
// Invalidate the token and ensure that we have the correct token provider for the challenge
|
||||||
// which we just received
|
// which we just received
|
||||||
if (retries < m_maxAuthRetries)
|
VssHttpEventSource.Log.AuthenticationFailed(traceActivity, response);
|
||||||
{
|
|
||||||
VssHttpEventSource.Log.AuthenticationFailed(traceActivity, response);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
VssHttpEventSource.Log.AuthenticationFailedOnFirstRequest(traceActivity, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (provider != null)
|
if (provider != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
using Newtonsoft.Json.Serialization;
|
|
||||||
|
|
||||||
namespace GitHub.Actions.Pipelines.WebApi
|
namespace GitHub.Actions.Pipelines.WebApi
|
||||||
{
|
{
|
||||||
@@ -10,7 +9,7 @@ namespace GitHub.Actions.Pipelines.WebApi
|
|||||||
{
|
{
|
||||||
public UnknownEnumJsonConverter()
|
public UnknownEnumJsonConverter()
|
||||||
{
|
{
|
||||||
this.NamingStrategy = new CamelCaseNamingStrategy();
|
this.CamelCaseText = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CanConvert(Type objectType)
|
public override bool CanConvert(Type objectType)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Win32.Registry" Version="4.4.0" />
|
<PackageReference Include="Microsoft.Win32.Registry" Version="4.4.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||||
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.4" />
|
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.4" />
|
||||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.2.1" />
|
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.2.1" />
|
||||||
<PackageReference Include="System.Security.Cryptography.Cng" Version="4.4.0" />
|
<PackageReference Include="System.Security.Cryptography.Cng" Version="4.4.0" />
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ namespace GitHub.Services.WebApi
|
|||||||
if (!enumsAsNumbers)
|
if (!enumsAsNumbers)
|
||||||
{
|
{
|
||||||
// Serialze enums as camelCased string values
|
// Serialze enums as camelCased string values
|
||||||
this.SerializerSettings.Converters.Add(new StringEnumConverter { NamingStrategy = new CamelCaseNamingStrategy() });
|
this.SerializerSettings.Converters.Add(new StringEnumConverter { CamelCaseText = true });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useMsDateFormat)
|
if (useMsDateFormat)
|
||||||
|
|||||||
@@ -622,7 +622,6 @@ namespace GitHub.Runner.Common.Tests.Worker
|
|||||||
_stepContext.SetOutcome("", stepContext.Object.ContextName, (stepContext.Object.Outcome ?? stepContext.Object.Result ?? TaskResult.Succeeded).ToActionResult());
|
_stepContext.SetOutcome("", stepContext.Object.ContextName, (stepContext.Object.Outcome ?? stepContext.Object.Result ?? TaskResult.Succeeded).ToActionResult());
|
||||||
_stepContext.SetConclusion("", stepContext.Object.ContextName, (stepContext.Object.Result ?? TaskResult.Succeeded).ToActionResult());
|
_stepContext.SetConclusion("", stepContext.Object.ContextName, (stepContext.Object.Result ?? TaskResult.Succeeded).ToActionResult());
|
||||||
});
|
});
|
||||||
stepContext.Setup(x => x.StepEnvironmentOverrides).Returns(new List<string>());
|
|
||||||
|
|
||||||
stepContext.Setup(x => x.UpdateGlobalStepsContext()).Callback(() =>
|
stepContext.Setup(x => x.UpdateGlobalStepsContext()).Callback(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
2.294.0
|
2.293.0
|
||||||
|
|||||||
Reference in New Issue
Block a user