mirror of
https://github.com/actions/runner.git
synced 2025-12-12 23:46:12 +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,7 +302,10 @@ namespace GitHub.Runner.Worker
|
|||||||
{
|
{
|
||||||
if (!container.IsJobContainer)
|
if (!container.IsJobContainer)
|
||||||
{
|
{
|
||||||
|
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 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}");
|
executionContext.Output($"Print service container logs: {container.ContainerDisplayName}");
|
||||||
|
|
||||||
int logsExitCode = await _dockerManager.DockerLogs(executionContext, container.ContainerId);
|
int logsExitCode = await _dockerManager.DockerLogs(executionContext, container.ContainerId);
|
||||||
@@ -311,6 +314,7 @@ namespace GitHub.Runner.Worker
|
|||||||
executionContext.Warning($"Docker logs fail with exit code {logsExitCode}");
|
executionContext.Warning($"Docker logs fail with exit code {logsExitCode}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
executionContext.Output($"Stop and remove container: {container.ContainerDisplayName}");
|
executionContext.Output($"Stop and remove container: {container.ContainerDisplayName}");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user