diff --git a/AppHandling/PsTestFunctions.ps1 b/AppHandling/PsTestFunctions.ps1 index 018d8acaf..f7aab73ba 100644 --- a/AppHandling/PsTestFunctions.ps1 +++ b/AppHandling/PsTestFunctions.ps1 @@ -473,6 +473,19 @@ function Run-ConnectionTest { Write-Host "Extension Management successfully closed" } +function GetDT { + Param( + $val + ) + + if ($val -is [DateTime]) { + $val + } + else { + [DateTime]::Parse($val) + } +} + function Run-Tests { Param( [ClientContext] $clientContext, @@ -661,8 +674,8 @@ function Run-Tests { $XUnitAssembly = $XUnitDoc.CreateElement("assembly") $XUnitAssembly.SetAttribute("name","$($result.codeUnit) $($result.name)") $XUnitAssembly.SetAttribute("test-framework", "PS Test Runner") - $XUnitAssembly.SetAttribute("run-date", [DateTime]::Parse($result.startTime).ToString("yyyy-MM-dd")) - $XUnitAssembly.SetAttribute("run-time", [DateTime]::Parse($result.startTime).ToString("HH':'mm':'ss")) + $XUnitAssembly.SetAttribute("run-date", (GetDT -val $result.startTime).ToString("yyyy-MM-dd")) + $XUnitAssembly.SetAttribute("run-time", (GetDT -val $result.startTime).ToString("HH':'mm':'ss")) $XUnitAssembly.SetAttribute("total", $result.testResults.Count) $XUnitCollection = $XUnitDoc.CreateElement("collection") $XUnitAssembly.AppendChild($XUnitCollection) | Out-Null @@ -715,7 +728,7 @@ function Run-Tests { $property.SetAttribute("value", "{ ""Version"": ""$($VersionInfo.ProductVersion)"" }") $JunitTestSuiteProperties.AppendChild($property) | Out-Null - Get-NavAppInfo -ServerInstance $serverInstance | % { + Get-NavAppInfo -ServerInstance $serverInstance | ForEach-Object { $property = $JUnitDoc.CreateElement("property") $property.SetAttribute("name", "app.info") $property.SetAttribute("value", "{ ""Name"": ""$($_.Name)"", ""Publisher"": ""$($_.Publisher)"", ""Version"": ""$($_.Version)"" }") @@ -724,13 +737,12 @@ function Run-Tests { $dumpAppsToTestOutput = $false } } - } $totalduration = [Timespan]::Zero if ($result.PSobject.Properties.name -eq "testResults") { - $result.testResults | % { - $testduration = [DateTime]::Parse($_.finishTime).Subtract([DateTime]::Parse($_.startTime)) + $result.testResults | ForEach-Object { + $testduration = (GetDT -val $_.finishTime).Subtract((GetDT -val $_.startTime)) if ($testduration.TotalSeconds -lt 0) { $testduration = [timespan]::Zero } $totalduration += $testduration } @@ -752,8 +764,8 @@ function Run-Tests { $skipped = 0 if ($result.PSobject.Properties.name -eq "testResults") { - $result.testResults | % { - $testduration = [DateTime]::Parse($_.finishTime).Subtract([DateTime]::Parse($_.startTime)) + $result.testResults | ForEach-Object { + $testduration = (GetDT -val $_.finishTime).Subtract((GetDT -val $_.startTime)) if ($testduration.TotalSeconds -lt 0) { $testduration = [timespan]::Zero } if ($XUnitResultFileName) { diff --git a/ContainerHandling/Flush-ContainerHelperCache.ps1 b/ContainerHandling/Flush-ContainerHelperCache.ps1 index 87c032a9b..c344a54cd 100644 --- a/ContainerHandling/Flush-ContainerHelperCache.ps1 +++ b/ContainerHandling/Flush-ContainerHelperCache.ps1 @@ -54,7 +54,12 @@ try { $containerName = $_.Split(':')[1] $inspect = docker inspect $containerID | ConvertFrom-Json try { - $finishedAt = [DateTime]::Parse($inspect.state.FinishedAt) + if ($inspect.state.FinishedAt -is [datetime]) { + $finishedAt = $inspect.state.FinishedAt + } + else { + $finishedAt = [DateTime]::Parse($inspect.state.FinishedAt) + } $exitedDaysAgo = [DateTime]::Now.Subtract($finishedAt).Days if ($exitedDaysAgo -ge $keepDays) { if (($inspect.Config.Labels.psobject.Properties.Match('maintainer').Count -ne 0 -and $inspect.Config.Labels.maintainer -eq "Dynamics SMB")) { diff --git a/ContainerHandling/New-NavImage.ps1 b/ContainerHandling/New-NavImage.ps1 index 7cfff2afa..82728c6ac 100644 --- a/ContainerHandling/New-NavImage.ps1 +++ b/ContainerHandling/New-NavImage.ps1 @@ -411,12 +411,8 @@ try { } elseif ($hostOsVersion.Build -ge 20348 -and $containerOsVersion.Build -ge 20348) { if ($isolation -eq "") { - if ($containerOsVersion -le $hostOsVersion) { - $isolation = "process" - } - else { - $isolation = "hyperv" - } + Write-Host -ForegroundColor Yellow "WARNING: Container and host OS build is 20348 or above, defaulting to process isolation. If you encounter issues, you could try to install HyperV." + $isolation = "process" } } elseif (("$hostOsVersion".StartsWith('10.0.19043.') -or "$hostOsVersion".StartsWith('10.0.19044.') -or "$hostOsVersion".StartsWith('10.0.19045.')) -and "$containerOsVersion".StartsWith("10.0.19041.")) { diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index be8962fb2..ab6e4b2f8 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -1,3 +1,7 @@ +6.0.11 +Issue 3420 New-BcImage uses hyperv even if it is disabled +Issue 3411 Run-AlPipeline: Exception calling "Parse" with "1" argument(s): "String '' was not recognized as a valid DateTime. + 6.0.10 Issue 3415 Use process isolation diff --git a/Version.txt b/Version.txt index 58298e7c2..c650c27fb 100644 --- a/Version.txt +++ b/Version.txt @@ -1 +1 @@ -6.0.10-dev +6.0.11-dev