Compare commits

..

12 Commits

Author SHA1 Message Date
Luke Tomlinson
a52c53955c Prepare v2.315.0 release (#3216) 2024-03-22 11:38:53 -04:00
Luke Tomlinson
8ebf298bcd Always Delete Actions Service Session (#3214)
* Delete Actions Service session always

* update tes
2024-03-21 16:30:34 -04:00
Jacob Wallraff
4b85145661 Handle new non-retryable exception type (#3191)
* Handle new non-retryable exception type

* Update ActionManager.cs
2024-03-21 18:50:45 +00:00
Nikola Jokic
bc8b6e0152 Bump docker version and docker buildx version (#3208) 2024-03-20 11:16:41 -04:00
github-actions[bot]
82e01c6173 Upgrade dotnet sdk to v6.0.420 (#3211)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-03-17 22:42:44 -04:00
Nikola Jokic
93bc1cd918 Bump hook version to 0.6.0 (#3203) 2024-03-15 11:13:29 -04:00
Tatyana Kostromskaya
692d910868 Add ability to enforce actions to run on node20 (#3192)
Add options to enforce actions execute on node20
2024-03-14 14:12:08 +01:00
Patrick Carnahan
2c8c941622 consume new pipelines service url in handlers (#3185)
* consume pipelines service url if present

updates how the `ACTIONS_RUNTIME_URL` variable is set to utilize a new value, `PipelinesServiceUrl` if present in the endpoint. if this value is not present then the existing system connection endpoint is used to retain backward compatibility.

* consume pipelines url

updates how the `ACTIONS_RUNTIME_URL` variable is set to utilize a new value, `PipelinesServiceUrl` if present in the endpoint. if this value is not present then the existing system connection endpoint is used to retain backward compatibility.
2024-03-05 11:13:16 -05:00
Nikola Jokic
86d6211c75 Remove -f flag in wait when manually trap signal (#3182)
* Remove -f flag in wait when manually trap signal

* Remove extra empty line
2024-03-04 11:32:21 +01:00
Yashwanth Anantharaju
aa90563cae don't crash listener on getting job exceptions (#3177) 2024-02-29 15:39:29 +00:00
Tingluo Huang
4cb3cb2962 Bump runner version to match the latest patch release (#3175) 2024-02-28 20:08:31 +00:00
Ryan Troost
d7777fd632 fix summaries for actions results (#3174)
* fix summaries for actions results

* remove negative
2024-02-27 15:22:26 -05:00
18 changed files with 122 additions and 27 deletions

View File

@@ -4,7 +4,7 @@
"features": { "features": {
"ghcr.io/devcontainers/features/docker-in-docker:1": {}, "ghcr.io/devcontainers/features/docker-in-docker:1": {},
"ghcr.io/devcontainers/features/dotnet": { "ghcr.io/devcontainers/features/dotnet": {
"version": "6.0.419" "version": "6.0.420"
}, },
"ghcr.io/devcontainers/features/node:1": { "ghcr.io/devcontainers/features/node:1": {
"version": "16" "version": "16"

View File

@@ -4,9 +4,9 @@ FROM mcr.microsoft.com/dotnet/runtime-deps:6.0-jammy as build
ARG TARGETOS ARG TARGETOS
ARG TARGETARCH ARG TARGETARCH
ARG RUNNER_VERSION ARG RUNNER_VERSION
ARG RUNNER_CONTAINER_HOOKS_VERSION=0.5.1 ARG RUNNER_CONTAINER_HOOKS_VERSION=0.6.0
ARG DOCKER_VERSION=25.0.2 ARG DOCKER_VERSION=25.0.4
ARG BUILDX_VERSION=0.12.1 ARG BUILDX_VERSION=0.13.1
RUN apt update -y && apt install curl unzip -y RUN apt update -y && apt install curl unzip -y

View File

@@ -1,20 +1,21 @@
## What's Changed ## What's Changed
* Prepare v2.313.0 Release by @luketomlinson in https://github.com/actions/runner/pull/3137 * fix summaries for actions results by @SrRyan in https://github.com/actions/runner/pull/3174
* Pass RunnerOS during job acquire. by @TingluoHuang in https://github.com/actions/runner/pull/3140 * Bump runner version to match the latest patch release by @TingluoHuang in https://github.com/actions/runner/pull/3175
* Process `snapshot` tokens by @davidomid in https://github.com/actions/runner/pull/3135 * don't crash listener on getting job exceptions for run-service by @yaananth in https://github.com/actions/runner/pull/3177
* Update dotnet sdk to latest version @6.0.419 by @github-actions in https://github.com/actions/runner/pull/3158 * Remove -f flag in wait when manually trap signal by @nikola-jokic in https://github.com/actions/runner/pull/3182
* handle broker run service exception handling by @yaananth in https://github.com/actions/runner/pull/3163 * consume new pipelines service url in handlers by @patrickcarnahan in https://github.com/actions/runner/pull/3185
* Add a retry logic to docker login operation by @enescakir in https://github.com/actions/runner/pull/3089 * Add ability to enforce actions to run on node20 by @takost in https://github.com/actions/runner/pull/3192
* Broker fixes for token refreshes and AccessDeniedException by @luketomlinson in https://github.com/actions/runner/pull/3161 * Bump hook version to 0.6.0 by @nikola-jokic in https://github.com/actions/runner/pull/3203
* Remove USE_BROKER_FLOW by @luketomlinson in https://github.com/actions/runner/pull/3162 * Update dotnet sdk to latest version @6.0.420 by @github-actions in https://github.com/actions/runner/pull/3211
* Refresh Token for BrokerServer by @luketomlinson in https://github.com/actions/runner/pull/3167 * Bump docker version and docker buildx version by @nikola-jokic in https://github.com/actions/runner/pull/3208
* Better step timeout message. by @TingluoHuang in https://github.com/actions/runner/pull/3166 * Handle new non-retryable exception type by @thyeggman in https://github.com/actions/runner/pull/3191
* Fix summaries for actions results by @SrRyan in https://github.com/actions/runner/pull/3174 * Always Delete Actions Service Session by @luketomlinson in https://github.com/actions/runner/pull/3214
## New Contributors ## New Contributors
* @davidomid made their first contribution in https://github.com/actions/runner/pull/3135
* @enescakir made their first contribution in https://github.com/actions/runner/pull/3089
* @SrRyan made their first contribution in https://github.com/actions/runner/pull/3174 * @SrRyan made their first contribution in https://github.com/actions/runner/pull/3174
* @patrickcarnahan made their first contribution in https://github.com/actions/runner/pull/3185
**Full Changelog**: https://github.com/actions/runner/compare/v2.314.1...v2.315.0
**Full Changelog**: https://github.com/actions/runner/compare/v2.313.0...v2.314.0 **Full Changelog**: https://github.com/actions/runner/compare/v2.313.0...v2.314.0

View File

@@ -1 +1 @@
2.314.1 <Update to ./src/runnerversion when creating release>

View File

@@ -38,7 +38,7 @@ runWithManualTrap() {
cp -f "$DIR"/run-helper.sh.template "$DIR"/run-helper.sh cp -f "$DIR"/run-helper.sh.template "$DIR"/run-helper.sh
"$DIR"/run-helper.sh $* & "$DIR"/run-helper.sh $* &
PID=$! PID=$!
wait -f $PID wait $PID
returnCode=$? returnCode=$?
if [[ $returnCode -eq 2 ]]; then if [[ $returnCode -eq 2 ]]; then
echo "Restarting runner..." echo "Restarting runner..."
@@ -84,4 +84,4 @@ if [[ -z "$RUNNER_MANUALLY_TRAP_SIG" ]]; then
run $* run $*
else else
runWithManualTrap $* runWithManualTrap $*
fi fi

View File

@@ -180,6 +180,9 @@ namespace GitHub.Runner.Common
public static readonly string DeprecatedNodeVersion = "node16"; public static readonly string DeprecatedNodeVersion = "node16";
public static readonly string EnforcedNode12DetectedAfterEndOfLife = "The following actions uses node12 which is deprecated and will be forced to run on node16: {0}. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/"; public static readonly string EnforcedNode12DetectedAfterEndOfLife = "The following actions uses node12 which is deprecated and will be forced to run on node16: {0}. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/";
public static readonly string EnforcedNode12DetectedAfterEndOfLifeEnvVariable = "Node16ForceActionsWarnings"; public static readonly string EnforcedNode12DetectedAfterEndOfLifeEnvVariable = "Node16ForceActionsWarnings";
public static readonly string EnforcedNode16DetectedAfterEndOfLife = "The following actions uses Node.js version which is deprecated and will be forced to run on node20: {0}. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/";
public static readonly string EnforcedNode16DetectedAfterEndOfLifeEnvVariable = "Node20ForceActionsWarnings";
} }
public static class RunnerEvent public static class RunnerEvent
@@ -251,6 +254,7 @@ namespace GitHub.Runner.Common
public static readonly string RunnerDebug = "ACTIONS_RUNNER_DEBUG"; public static readonly string RunnerDebug = "ACTIONS_RUNNER_DEBUG";
public static readonly string StepDebug = "ACTIONS_STEP_DEBUG"; public static readonly string StepDebug = "ACTIONS_STEP_DEBUG";
public static readonly string AllowActionsUseUnsecureNodeVersion = "ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION"; public static readonly string AllowActionsUseUnsecureNodeVersion = "ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION";
public static readonly string ManualForceActionsToNode20 = "FORCE_JAVASCRIPT_ACTIONS_TO_NODE20";
} }
public static class Agent public static class Agent
@@ -262,6 +266,7 @@ namespace GitHub.Runner.Common
public static readonly string ForcedActionsNodeVersion = "ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION"; public static readonly string ForcedActionsNodeVersion = "ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION";
public static readonly string PrintLogToStdout = "ACTIONS_RUNNER_PRINT_LOG_TO_STDOUT"; public static readonly string PrintLogToStdout = "ACTIONS_RUNNER_PRINT_LOG_TO_STDOUT";
public static readonly string ActionArchiveCacheDirectory = "ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE"; public static readonly string ActionArchiveCacheDirectory = "ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE";
public static readonly string ManualForceActionsToNode20 = "FORCE_JAVASCRIPT_ACTIONS_TO_NODE20";
} }
public static class System public static class System

View File

@@ -188,12 +188,12 @@ namespace GitHub.Runner.Listener
{ {
using (var ts = new CancellationTokenSource(TimeSpan.FromSeconds(30))) using (var ts = new CancellationTokenSource(TimeSpan.FromSeconds(30)))
{ {
await _runnerServer.DeleteAgentSessionAsync(_settings.PoolId, _session.SessionId, ts.Token);
if (_isBrokerSession) if (_isBrokerSession)
{ {
await _brokerServer.DeleteSessionAsync(ts.Token); await _brokerServer.DeleteSessionAsync(ts.Token);
return;
} }
await _runnerServer.DeleteAgentSessionAsync(_settings.PoolId, _session.SessionId, ts.Token);
} }
} }
else else

View File

@@ -567,6 +567,11 @@ namespace GitHub.Runner.Listener
Trace.Info("Job is already acquired, skip this message."); Trace.Info("Job is already acquired, skip this message.");
continue; continue;
} }
catch (Exception ex)
{
Trace.Error($"Caught exception from acquiring job message: {ex}");
continue;
}
} }
jobDispatcher.Run(jobRequestMessage, runOnce); jobDispatcher.Run(jobRequestMessage, runOnce);

View File

@@ -703,11 +703,12 @@ namespace GitHub.Runner.Worker
catch (Exception ex) when (!executionContext.CancellationToken.IsCancellationRequested) // Do not retry if the run is cancelled. catch (Exception ex) when (!executionContext.CancellationToken.IsCancellationRequested) // Do not retry if the run is cancelled.
{ {
// UnresolvableActionDownloadInfoException is a 422 client error, don't retry // UnresolvableActionDownloadInfoException is a 422 client error, don't retry
// NonRetryableActionDownloadInfoException is an non-retryable exception from Actions
// Some possible cases are: // Some possible cases are:
// * Repo is rate limited // * Repo is rate limited
// * Repo or tag doesn't exist, or isn't public // * Repo or tag doesn't exist, or isn't public
// * Policy validation failed // * Policy validation failed
if (attempt < 3 && !(ex is WebApi.UnresolvableActionDownloadInfoException)) if (attempt < 3 && !(ex is WebApi.UnresolvableActionDownloadInfoException) && !(ex is WebApi.NonRetryableActionDownloadInfoException))
{ {
executionContext.Output($"Failed to resolve action download info. Error: {ex.Message}"); executionContext.Output($"Failed to resolve action download info. Error: {ex.Message}");
executionContext.Debug(ex.ToString()); executionContext.Debug(ex.ToString());

View File

@@ -223,6 +223,10 @@ namespace GitHub.Runner.Worker.Handlers
{ {
Environment["ACTIONS_CACHE_URL"] = cacheUrl; Environment["ACTIONS_CACHE_URL"] = cacheUrl;
} }
if (systemConnection.Data.TryGetValue("PipelinesServiceUrl", out var pipelinesServiceUrl) && !string.IsNullOrEmpty(pipelinesServiceUrl))
{
Environment["ACTIONS_RUNTIME_URL"] = pipelinesServiceUrl;
}
if (systemConnection.Data.TryGetValue("GenerateIdTokenUrl", out var generateIdTokenUrl) && !string.IsNullOrEmpty(generateIdTokenUrl)) if (systemConnection.Data.TryGetValue("GenerateIdTokenUrl", out var generateIdTokenUrl) && !string.IsNullOrEmpty(generateIdTokenUrl))
{ {
Environment["ACTIONS_ID_TOKEN_REQUEST_URL"] = generateIdTokenUrl; Environment["ACTIONS_ID_TOKEN_REQUEST_URL"] = generateIdTokenUrl;

View File

@@ -84,6 +84,45 @@ namespace GitHub.Runner.Worker.Handlers
} }
nodeData.NodeVersion = "node16"; nodeData.NodeVersion = "node16";
} }
var localForceActionsToNode20 = StringUtil.ConvertToBoolean(Environment.GetEnvironmentVariable(Constants.Variables.Agent.ManualForceActionsToNode20));
executionContext.Global.EnvironmentVariables.TryGetValue(Constants.Variables.Actions.ManualForceActionsToNode20, out var workflowForceActionsToNode20);
var enforceNode20Locally = !string.IsNullOrWhiteSpace(workflowForceActionsToNode20) ? StringUtil.ConvertToBoolean(workflowForceActionsToNode20) : localForceActionsToNode20;
if (string.Equals(nodeData.NodeVersion, "node16")
&& ((executionContext.Global.Variables.GetBoolean("DistributedTask.ForceGithubJavascriptActionsToNode20") ?? false) || enforceNode20Locally))
{
executionContext.Global.EnvironmentVariables.TryGetValue(Constants.Variables.Actions.AllowActionsUseUnsecureNodeVersion, out var workflowOptOut);
var isWorkflowOptOutSet = !string.IsNullOrWhiteSpace(workflowOptOut);
var isLocalOptOut = StringUtil.ConvertToBoolean(Environment.GetEnvironmentVariable(Constants.Variables.Actions.AllowActionsUseUnsecureNodeVersion));
bool isOptOut = isWorkflowOptOutSet ? StringUtil.ConvertToBoolean(workflowOptOut) : isLocalOptOut;
if (!isOptOut)
{
var repoAction = action as Pipelines.RepositoryPathReference;
if (repoAction != null)
{
var warningActions = new HashSet<string>();
if (executionContext.Global.Variables.TryGetValue(Constants.Runner.EnforcedNode16DetectedAfterEndOfLifeEnvVariable, out var node20ForceWarnings))
{
warningActions = StringUtil.ConvertFromJson<HashSet<string>>(node20ForceWarnings);
}
string repoActionFullName;
if (string.IsNullOrEmpty(repoAction.Name))
{
repoActionFullName = repoAction.Path; // local actions don't have a 'Name'
}
else
{
repoActionFullName = $"{repoAction.Name}/{repoAction.Path ?? string.Empty}".TrimEnd('/') + $"@{repoAction.Ref}";
}
warningActions.Add(repoActionFullName);
executionContext.Global.Variables.Set(Constants.Runner.EnforcedNode16DetectedAfterEndOfLifeEnvVariable, StringUtil.ConvertToJson(warningActions));
}
nodeData.NodeVersion = "node20";
}
}
(handler as INodeScriptActionHandler).Data = nodeData; (handler as INodeScriptActionHandler).Data = nodeData;
} }
else if (data.ExecutionType == ActionExecutionType.Script) else if (data.ExecutionType == ActionExecutionType.Script)

View File

@@ -58,6 +58,10 @@ namespace GitHub.Runner.Worker.Handlers
{ {
Environment["ACTIONS_CACHE_URL"] = cacheUrl; Environment["ACTIONS_CACHE_URL"] = cacheUrl;
} }
if (systemConnection.Data.TryGetValue("PipelinesServiceUrl", out var pipelinesServiceUrl) && !string.IsNullOrEmpty(pipelinesServiceUrl))
{
Environment["ACTIONS_RUNTIME_URL"] = pipelinesServiceUrl;
}
if (systemConnection.Data.TryGetValue("GenerateIdTokenUrl", out var generateIdTokenUrl) && !string.IsNullOrEmpty(generateIdTokenUrl)) if (systemConnection.Data.TryGetValue("GenerateIdTokenUrl", out var generateIdTokenUrl) && !string.IsNullOrEmpty(generateIdTokenUrl))
{ {
Environment["ACTIONS_ID_TOKEN_REQUEST_URL"] = generateIdTokenUrl; Environment["ACTIONS_ID_TOKEN_REQUEST_URL"] = generateIdTokenUrl;
@@ -114,6 +118,11 @@ namespace GitHub.Runner.Worker.Handlers
{ {
Data.NodeVersion = "node16"; Data.NodeVersion = "node16";
} }
if (forcedNodeVersion == "node20" && Data.NodeVersion != "node20")
{
Data.NodeVersion = "node20";
}
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}");

View File

@@ -298,6 +298,12 @@ namespace GitHub.Runner.Worker
jobContext.Warning(string.Format(Constants.Runner.EnforcedNode12DetectedAfterEndOfLife, actions)); jobContext.Warning(string.Format(Constants.Runner.EnforcedNode12DetectedAfterEndOfLife, actions));
} }
if (jobContext.Global.Variables.TryGetValue(Constants.Runner.EnforcedNode16DetectedAfterEndOfLifeEnvVariable, out var node20ForceWarnings) && (jobContext.Global.Variables.GetBoolean("DistributedTask.ForceGithubJavascriptActionsToNode20") ?? false))
{
var actions = string.Join(", ", StringUtil.ConvertFromJson<HashSet<string>>(node20ForceWarnings));
jobContext.Warning(string.Format(Constants.Runner.EnforcedNode16DetectedAfterEndOfLife, actions));
}
await ShutdownQueue(throwOnFailure: false); await ShutdownQueue(throwOnFailure: false);
// Make sure to clean temp after file upload since they may be pending fileupload still use the TEMP dir. // Make sure to clean temp after file upload since they may be pending fileupload still use the TEMP dir.
@@ -405,6 +411,12 @@ namespace GitHub.Runner.Worker
jobContext.Warning(string.Format(Constants.Runner.EnforcedNode12DetectedAfterEndOfLife, actions)); jobContext.Warning(string.Format(Constants.Runner.EnforcedNode12DetectedAfterEndOfLife, actions));
} }
if (jobContext.Global.Variables.TryGetValue(Constants.Runner.EnforcedNode16DetectedAfterEndOfLifeEnvVariable, out var node20ForceWarnings))
{
var actions = string.Join(", ", StringUtil.ConvertFromJson<HashSet<string>>(node20ForceWarnings));
jobContext.Warning(string.Format(Constants.Runner.EnforcedNode16DetectedAfterEndOfLife, actions));
}
try try
{ {
var jobQueueTelemetry = await ShutdownQueue(throwOnFailure: true); var jobQueueTelemetry = await ShutdownQueue(throwOnFailure: true);

View File

@@ -2498,6 +2498,25 @@ namespace GitHub.DistributedTask.WebApi
} }
} }
[Serializable]
public class NonRetryableActionDownloadInfoException : DistributedTaskException
{
public NonRetryableActionDownloadInfoException(String message)
: base(message)
{
}
public NonRetryableActionDownloadInfoException(String message, Exception innerException)
: base(message, innerException)
{
}
protected NonRetryableActionDownloadInfoException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
[Serializable] [Serializable]
public sealed class FailedToResolveActionDownloadInfoException : DistributedTaskException public sealed class FailedToResolveActionDownloadInfoException : DistributedTaskException
{ {

View File

@@ -272,7 +272,7 @@ namespace GitHub.Runner.Common.Tests.Listener
//Assert //Assert
_runnerServer _runnerServer
.Verify(x => x.DeleteAgentSessionAsync( .Verify(x => x.DeleteAgentSessionAsync(
_settings.PoolId, expectedSession.SessionId, It.IsAny<CancellationToken>()), Times.Never()); _settings.PoolId, expectedBrokerSession.SessionId, It.IsAny<CancellationToken>()), Times.Once());
_brokerServer _brokerServer
.Verify(x => x.DeleteSessionAsync(It.IsAny<CancellationToken>()), Times.Once()); .Verify(x => x.DeleteSessionAsync(It.IsAny<CancellationToken>()), Times.Once());
} }

View File

@@ -17,7 +17,7 @@ LAYOUT_DIR="$SCRIPT_DIR/../_layout"
DOWNLOAD_DIR="$SCRIPT_DIR/../_downloads/netcore2x" DOWNLOAD_DIR="$SCRIPT_DIR/../_downloads/netcore2x"
PACKAGE_DIR="$SCRIPT_DIR/../_package" PACKAGE_DIR="$SCRIPT_DIR/../_package"
DOTNETSDK_ROOT="$SCRIPT_DIR/../_dotnetsdk" DOTNETSDK_ROOT="$SCRIPT_DIR/../_dotnetsdk"
DOTNETSDK_VERSION="6.0.419" DOTNETSDK_VERSION="6.0.420"
DOTNETSDK_INSTALLDIR="$DOTNETSDK_ROOT/$DOTNETSDK_VERSION" DOTNETSDK_INSTALLDIR="$DOTNETSDK_ROOT/$DOTNETSDK_VERSION"
RUNNER_VERSION=$(cat runnerversion) RUNNER_VERSION=$(cat runnerversion)

View File

@@ -1,5 +1,5 @@
{ {
"sdk": { "sdk": {
"version": "6.0.419" "version": "6.0.420"
} }
} }

View File

@@ -1 +1 @@
2.314.1 2.315.0