mirror of
https://github.com/actions/runner.git
synced 2025-12-10 20:36:49 +00:00
Print service containers only if they were healthy
Unhealthy service logs are printed in ContainerHealthCheckLogs called prior to this step.
This commit is contained in:
@@ -302,14 +302,18 @@ namespace GitHub.Runner.Worker
|
||||
{
|
||||
if (!container.IsJobContainer)
|
||||
{
|
||||
// Print logs for service container jobs (not the "action" job itself b/c that's already logged).
|
||||
executionContext.Output($"Print service container logs: {container.ContainerDisplayName}");
|
||||
var healthcheck = await Healthcheck(executionContext, container);
|
||||
if (string.Equals(healthcheck, "healthy", StringComparison.OrdinalIgnoreCase)){
|
||||
// Print logs for service container jobs (not the "action" job itself b/c that's already logged).
|
||||
// Print them only if the service was healthy, else they were already logged via ContainerHealthCheckLogs.
|
||||
executionContext.Output($"Print service container logs: {container.ContainerDisplayName}");
|
||||
|
||||
int logsExitCode = await _dockerManager.DockerLogs(executionContext, container.ContainerId);
|
||||
if (logsExitCode != 0)
|
||||
{
|
||||
executionContext.Warning($"Docker logs fail with exit code {logsExitCode}");
|
||||
}
|
||||
int logsExitCode = await _dockerManager.DockerLogs(executionContext, container.ContainerId);
|
||||
if (logsExitCode != 0)
|
||||
{
|
||||
executionContext.Warning($"Docker logs fail with exit code {logsExitCode}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
executionContext.Output($"Stop and remove container: {container.ContainerDisplayName}");
|
||||
|
||||
Reference in New Issue
Block a user