Add support to persist pip reports (#1224)
* add support to persist pip report * pr feedback
This commit is contained in:
Родитель
924c4ea498
Коммит
f27fe8e98e
|
@ -131,7 +131,7 @@ public class PipCommandService : IPipCommandService
|
|||
var workingDir = new DirectoryInfo(this.pathUtilityService.GetParentDirectory(formattedPath));
|
||||
|
||||
CommandLineExecutionResult command;
|
||||
var reportName = Path.GetRandomFileName();
|
||||
var reportName = Path.GetFileNameWithoutExtension(Path.GetRandomFileName()) + ".component-detection-pip-report.json";
|
||||
var reportFile = new FileInfo(Path.Combine(workingDir.FullName, reportName));
|
||||
|
||||
string pipReportCommand;
|
||||
|
|
|
@ -22,6 +22,7 @@ public class PipReportComponentDetector : FileComponentDetector
|
|||
private const string PipReportOverrideBehaviorEnvVar = "PipReportOverrideBehavior";
|
||||
private const string PipReportSkipFallbackOnFailureEnvVar = "PipReportSkipFallbackOnFailure";
|
||||
private const string PipReportFileLevelTimeoutSecondsEnvVar = "PipReportFileLevelTimeoutSeconds";
|
||||
private const string PipReportPersistReportsEnvVar = "PipReportPersistReports";
|
||||
|
||||
private static readonly IList<string> PipReportPreGeneratedFilePatterns = new List<string> { "*.component-detection-pip-report.json", "component-detection-pip-report.json" };
|
||||
|
||||
|
@ -300,6 +301,8 @@ public class PipReportComponentDetector : FileComponentDetector
|
|||
finally
|
||||
{
|
||||
// Clean up the report output JSON file so it isn't left on the machine.
|
||||
if (!this.envVarService.IsEnvironmentVariableValueTrue(PipReportPersistReportsEnvVar))
|
||||
{
|
||||
foreach (var reportFile in reportFiles)
|
||||
{
|
||||
if (reportFile is not null && reportFile.Exists)
|
||||
|
@ -309,6 +312,7 @@ public class PipReportComponentDetector : FileComponentDetector
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<string, PipReportGraphNode> BuildGraphFromInstallationReport(PipInstallationReport report)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче