mirror of
https://github.com/actions/runner.git
synced 2025-12-14 22:24:11 +00:00
Fix page log name isn't unqiue. (#295)
This commit is contained in:
@@ -100,7 +100,7 @@ namespace GitHub.Runner.Common
|
|||||||
{
|
{
|
||||||
EndPage();
|
EndPage();
|
||||||
_byteCount = 0;
|
_byteCount = 0;
|
||||||
_dataFileName = Path.Combine(_pagesFolder, $"{_timelineRecordId}_{++_pageCount}.log");
|
_dataFileName = Path.Combine(_pagesFolder, $"{_timelineId}_{_timelineRecordId}_{++_pageCount}.log");
|
||||||
_pageData = new FileStream(_dataFileName, FileMode.CreateNew);
|
_pageData = new FileStream(_dataFileName, FileMode.CreateNew);
|
||||||
_pageWriter = new StreamWriter(_pageData, System.Text.Encoding.UTF8);
|
_pageWriter = new StreamWriter(_pageData, System.Text.Encoding.UTF8);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -752,27 +752,32 @@ namespace GitHub.Runner.Listener
|
|||||||
foreach (var log in logs)
|
foreach (var log in logs)
|
||||||
{
|
{
|
||||||
var logName = Path.GetFileNameWithoutExtension(log);
|
var logName = Path.GetFileNameWithoutExtension(log);
|
||||||
|
var logNameParts = logName.Split('_', StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
if (logNameParts.Length != 3)
|
||||||
|
{
|
||||||
|
Trace.Warning($"log file '{log}' doesn't follow naming convension 'GUID_GUID_INT'.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
var logPageSeperator = logName.IndexOf('_');
|
var logPageSeperator = logName.IndexOf('_');
|
||||||
var logRecordId = Guid.Empty;
|
var logRecordId = Guid.Empty;
|
||||||
var pageNumber = 0;
|
var pageNumber = 0;
|
||||||
if (logPageSeperator < 0)
|
|
||||||
|
if (!Guid.TryParse(logNameParts[0], out Guid timelineId) || timelineId != timeline.Id)
|
||||||
{
|
{
|
||||||
Trace.Warning($"log file '{log}' doesn't follow naming convension 'GUID_INT'.");
|
Trace.Warning($"log file '{log}' is not belongs to current job");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!Guid.TryParse(logName.Substring(0, logPageSeperator), out logRecordId))
|
|
||||||
{
|
|
||||||
Trace.Warning($"log file '{log}' doesn't follow naming convension 'GUID_INT'.");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!int.TryParse(logName.Substring(logPageSeperator + 1), out pageNumber))
|
if (!Guid.TryParse(logNameParts[1], out logRecordId))
|
||||||
{
|
{
|
||||||
Trace.Warning($"log file '{log}' doesn't follow naming convension 'GUID_INT'.");
|
Trace.Warning($"log file '{log}' doesn't follow naming convension 'GUID_GUID_INT'.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!int.TryParse(logNameParts[2], out pageNumber))
|
||||||
|
{
|
||||||
|
Trace.Warning($"log file '{log}' doesn't follow naming convension 'GUID_GUID_INT'.");
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var record = timeline.Records.FirstOrDefault(x => x.Id == logRecordId);
|
var record = timeline.Records.FirstOrDefault(x => x.Id == logRecordId);
|
||||||
|
|||||||
Reference in New Issue
Block a user