mirror of
https://github.com/actions/runner.git
synced 2025-12-10 20:36:49 +00:00
Compare commits
6 Commits
fhammerl/d
...
v2.289.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
529e404063 | ||
|
|
c058208ce4 | ||
|
|
b3b97b7328 | ||
|
|
5f72720698 | ||
|
|
bc0c1263f0 | ||
|
|
82a4ca9a6b |
@@ -1,11 +1,7 @@
|
|||||||
## Features
|
## Features
|
||||||
|
|
||||||
## Bugs
|
## Bugs
|
||||||
- Fixed a crash on runner startup (#1770)
|
- Fixed an issue where websockets failed to successfully close when posting log lines (#1790)
|
||||||
|
|
||||||
## Misc
|
|
||||||
|
|
||||||
- Clarified the type of step running when running job started or completed hooks (#1769)
|
|
||||||
|
|
||||||
|
|
||||||
## Windows x64
|
## Windows x64
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<Update to ./src/runnerversion when creating release>
|
2.289.2
|
||||||
|
|||||||
@@ -143,8 +143,10 @@ namespace GitHub.Runner.Common
|
|||||||
|
|
||||||
public ValueTask DisposeAsync()
|
public ValueTask DisposeAsync()
|
||||||
{
|
{
|
||||||
_websocketClient?.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "Shutdown", CancellationToken.None);
|
CloseWebSocket(WebSocketCloseStatus.NormalClosure, CancellationToken.None);
|
||||||
|
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
|
|
||||||
return ValueTask.CompletedTask;
|
return ValueTask.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,7 +250,8 @@ namespace GitHub.Runner.Common
|
|||||||
if (failedAttemptsToPostBatchedLinesByWebsocket * 100 / totalBatchedLinesAttemptedByWebsocket > _minWebsocketFailurePercentageAllowed)
|
if (failedAttemptsToPostBatchedLinesByWebsocket * 100 / totalBatchedLinesAttemptedByWebsocket > _minWebsocketFailurePercentageAllowed)
|
||||||
{
|
{
|
||||||
Trace.Info($"Exhausted websocket allowed retries, we will not attempt websocket connection for this job to post lines again.");
|
Trace.Info($"Exhausted websocket allowed retries, we will not attempt websocket connection for this job to post lines again.");
|
||||||
_websocketClient?.CloseOutputAsync(WebSocketCloseStatus.InternalServerError, "Shutdown due to failures", cancellationToken);
|
CloseWebSocket(WebSocketCloseStatus.InternalServerError, cancellationToken);
|
||||||
|
|
||||||
// By setting it to null, we will ensure that we never try websocket path again for this job
|
// By setting it to null, we will ensure that we never try websocket path again for this job
|
||||||
_websocketClient = null;
|
_websocketClient = null;
|
||||||
}
|
}
|
||||||
@@ -276,6 +279,19 @@ namespace GitHub.Runner.Common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CloseWebSocket(WebSocketCloseStatus closeStatus, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_websocketClient?.CloseOutputAsync(closeStatus, "Closing websocket", cancellationToken);
|
||||||
|
}
|
||||||
|
catch (Exception websocketEx)
|
||||||
|
{
|
||||||
|
// In some cases this might be okay since the websocket might be open yet, so just close and don't trace exceptions
|
||||||
|
Trace.Info($"Failed to close websocket gracefully {websocketEx.GetType().Name}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Task<TaskAttachment> CreateAttachmentAsync(Guid scopeIdentifier, string hubName, Guid planId, Guid timelineId, Guid timelineRecordId, string type, string name, Stream uploadStream, CancellationToken cancellationToken)
|
public Task<TaskAttachment> CreateAttachmentAsync(Guid scopeIdentifier, string hubName, Guid planId, Guid timelineId, Guid timelineRecordId, string type, string name, Stream uploadStream, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
CheckConnection();
|
CheckConnection();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ using GitHub.Runner.Sdk;
|
|||||||
|
|
||||||
namespace GitHub.Runner.Worker.Container
|
namespace GitHub.Runner.Worker.Container
|
||||||
{
|
{
|
||||||
[ServiceLocator(Default = typeof(DockerHookCommandManager))]
|
[ServiceLocator(Default = typeof(DockerCommandManager))]
|
||||||
public interface IDockerCommandManager : IRunnerService
|
public interface IDockerCommandManager : IRunnerService
|
||||||
{
|
{
|
||||||
string DockerPath { get; }
|
string DockerPath { get; }
|
||||||
@@ -188,7 +188,7 @@ namespace GitHub.Runner.Worker.Container
|
|||||||
return outputStrings.FirstOrDefault();
|
return outputStrings.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<int> DockerRun(IExecutionContext context, ContainerInfo container, EventHandler<ProcessDataReceivedEventArgs> stdoutDataReceived, EventHandler<ProcessDataReceivedEventArgs> stderrDataReceived)
|
public async Task<int> DockerRun(IExecutionContext context, ContainerInfo container, EventHandler<ProcessDataReceivedEventArgs> stdoutDataReceived, EventHandler<ProcessDataReceivedEventArgs> stderrDataReceived)
|
||||||
{
|
{
|
||||||
IList<string> dockerOptions = new List<string>();
|
IList<string> dockerOptions = new List<string>();
|
||||||
// OPTIONS
|
// OPTIONS
|
||||||
@@ -258,7 +258,7 @@ namespace GitHub.Runner.Worker.Container
|
|||||||
return await ExecuteDockerCommandAsync(context, "run", optionsString, container.ContainerEnvironmentVariables, stdoutDataReceived, stderrDataReceived, context.CancellationToken);
|
return await ExecuteDockerCommandAsync(context, "run", optionsString, container.ContainerEnvironmentVariables, stdoutDataReceived, stderrDataReceived, context.CancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<int> DockerStart(IExecutionContext context, string containerId)
|
public async Task<int> DockerStart(IExecutionContext context, string containerId)
|
||||||
{
|
{
|
||||||
return await ExecuteDockerCommandAsync(context, "start", containerId, context.CancellationToken);
|
return await ExecuteDockerCommandAsync(context, "start", containerId, context.CancellationToken);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using GitHub.DistributedTask.Pipelines;
|
|
||||||
using GitHub.Runner.Common.Util;
|
|
||||||
using GitHub.Runner.Worker.Handlers;
|
|
||||||
|
|
||||||
namespace GitHub.Runner.Worker.Container
|
|
||||||
{
|
|
||||||
public class DockerHookCommandManager : DockerCommandManager
|
|
||||||
{
|
|
||||||
public override async Task<int> DockerStart(IExecutionContext context, string containerId)
|
|
||||||
{
|
|
||||||
// check for env var
|
|
||||||
// execute script
|
|
||||||
|
|
||||||
// Create the handler data.
|
|
||||||
var path = "/home/ferenc/Documents/runner/_layout/docker_run.sh";
|
|
||||||
var scriptDirectory = Path.GetDirectoryName(path);
|
|
||||||
var stepHost = HostContext.CreateService<IDefaultStepHost>();
|
|
||||||
var prependPath = string.Join(Path.PathSeparator.ToString(), context.Global.PrependPath.Reverse<string>());
|
|
||||||
Dictionary<string, string> inputs = new()
|
|
||||||
{
|
|
||||||
["script"] = $"CONT_ID={containerId} " + "/usr/bin/bash" + " " + path,
|
|
||||||
// /bin/bash
|
|
||||||
["shell"] = ScriptHandlerHelpers.GetDefaultShellForScript(path, Trace, prependPath)
|
|
||||||
};
|
|
||||||
|
|
||||||
// Create the handler
|
|
||||||
var handlerFactory = HostContext.GetService<IHandlerFactory>();
|
|
||||||
var handler = handlerFactory.Create(
|
|
||||||
context,
|
|
||||||
action: new ScriptReference(),
|
|
||||||
stepHost,
|
|
||||||
new ScriptActionExecutionData(),
|
|
||||||
inputs,
|
|
||||||
environment: new Dictionary<string, string>(VarUtil.EnvironmentVariableKeyComparer),
|
|
||||||
context.Global.Variables,
|
|
||||||
actionDirectory: scriptDirectory,
|
|
||||||
localActionContainerSetupSteps: null);
|
|
||||||
handler.PrepareExecution(ActionRunStage.Main); // TODO: find out stage
|
|
||||||
|
|
||||||
await handler.RunAsync(ActionRunStage.Main);
|
|
||||||
|
|
||||||
return ((int?) handler.ExecutionContext.CommandResult) ?? 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +1 @@
|
|||||||
2.289.1
|
2.289.2
|
||||||
|
|||||||
Reference in New Issue
Block a user