mirror of
https://github.com/actions/runner.git
synced 2025-12-12 05:37:01 +00:00
Remove unnecessary 'IsAnyUnhealthy' flag
This commit is contained in:
@@ -100,33 +100,33 @@ namespace GitHub.Runner.Worker
|
|||||||
}
|
}
|
||||||
|
|
||||||
executionContext.Output("##[group]Waiting for all services to be ready");
|
executionContext.Output("##[group]Waiting for all services to be ready");
|
||||||
bool IsAnyUnhealthy = false;
|
|
||||||
_dockerManager.UnhealthyContainers = new List<ContainerInfo>();
|
_dockerManager.UnhealthyContainers = new List<ContainerInfo>();
|
||||||
foreach (var container in containers.Where(c => !c.IsJobContainer))
|
foreach (var container in containers.Where(c => !c.IsJobContainer))
|
||||||
{
|
{
|
||||||
var healthcheck = await Healthcheck(executionContext, container);
|
var healthcheck = await Healthcheck(executionContext, container);
|
||||||
|
|
||||||
if (!string.Equals(healthcheck, "healthy", StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(healthcheck, "healthy", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
IsAnyUnhealthy = true;
|
|
||||||
_dockerManager.UnhealthyContainers.Add(container);
|
_dockerManager.UnhealthyContainers.Add(container);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
executionContext.Output($"{container.ContainerNetworkAlias} service is healthy.");
|
executionContext.Output($"{container.ContainerNetworkAlias} service is healthy.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
executionContext.Output("##[endgroup]");
|
executionContext.Output("##[endgroup]");
|
||||||
|
|
||||||
if (IsAnyUnhealthy)
|
if (_dockerManager.UnhealthyContainers.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (var container in _dockerManager.UnhealthyContainers)
|
foreach (var container in _dockerManager.UnhealthyContainers)
|
||||||
{
|
{
|
||||||
executionContext.Output($"##[group]Service container {container.ContainerNetworkAlias} failed.");
|
executionContext.Output($"##[group]Service container {container.ContainerNetworkAlias} failed.");
|
||||||
await ContainerErrorLogs(executionContext, container);
|
await ContainerErrorLogs(executionContext, container);
|
||||||
executionContext.Output("##[endgroup]");
|
executionContext.Output("##[endgroup]");
|
||||||
}
|
}
|
||||||
throw new InvalidOperationException("One or more containers failed to start.");
|
throw new InvalidOperationException("One or more containers failed to start.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printHello()
|
public void printHello()
|
||||||
|
|||||||
Reference in New Issue
Block a user