in Editor/Window/Containers/ConfigureDCIStep.cs [148:196]
private void ProcessLogFile()
{
try
{
if (!File.Exists(_logFilePath))
{
_mainThreadContext.Send(_ => TriggerWarning(
$"Could not find the logs for build process. The file may have been moved." +
$"\nExpected location: {_logFilePath}", _logOutputDirectory), null);
return;
}
var lines = File.ReadLines(_logFilePath);
Regex errorRegex = new Regex("^#\\d+ ERROR");
Regex writingImageRegex = new Regex("^#\\d+ writing image|exporting manifest list sha256:");
bool hitAnError = lines.FirstOrDefault(line => errorRegex.IsMatch(line)) != null;
bool imageWritten = lines.FirstOrDefault(line => writingImageRegex.IsMatch(line)) != null;
if (!hitAnError && imageWritten)
{
_mainThreadContext.Send(_ => SaveImageTagAndCompleteStep(), null);
}
else if (hitAnError && imageWritten)
{
_mainThreadContext.Send(_ => TriggerWarning(
$"Image built with errors. Please check the logs for details." +
$"\nLocation: {_logFilePath}"), null);
}
else if (hitAnError)
{
_mainThreadContext.Send(_ => FailStep(
$"Failed to build docker image due to execution failure. Please check" +
$" the logs for details.\nLocation: {_logFilePath}"), null);
}
else
{
_mainThreadContext.Send(_ => TriggerWarning(
$"Unknown result of docker build process. Please check the logs for details." +
$"\nLocation: {_logFilePath}"), null);
}
}
catch (Exception e)
{
_mainThreadContext.LogError($"Failed to build docker image due to unexpected exception:\n{e}.");
_mainThreadContext.Send(_ => FailStep(
$"Failed to build docker image due to unexpected exception: {e.Message}." +
$"\nSee Console for full exception.", false), null);
}
}