Fix run reports and Windows Home policy planning
Windows tests / test-and-build (push) Canceled after 0s
Windows tests / test-and-build (push) Canceled after 0s
This commit is contained in:
1 parent
942b849306
commit
22d06ac7fd
19 files changed
+72
-43
No files matched your search
@@ -17,7 +17,7 @@ function Invoke-MsPrivateGroupPlan {
|
||||
}
|
||||
$entries=@($Groups|ForEach-Object{[pscustomobject]@{Id=[string]$_.Id;Label=[string]$_.Label;DependsOn=@($_.DependsOn);Status='Pending';Error=$null}})
|
||||
$report=[pscustomobject]@{Schema=1;Kind='MsPrivateRun';CreatedUtc=[DateTime]::UtcNow.ToString('o');CompletedUtc=$null;Status='Running';Entries=$entries}
|
||||
$save={if($ReportPath){Write-MsPrivateJsonAtomic -InputObject $report -Path $ReportPath -Depth 8}}.GetNewClosure();&$save
|
||||
if($ReportPath){Write-MsPrivateJsonAtomic -InputObject $report -Path $ReportPath -Depth 8}
|
||||
foreach($group in $Groups){
|
||||
$entry=@($entries | Where-Object { $_.Id -ceq [string]$group.Id })[0]
|
||||
$blocked=@($entry.DependsOn | Where-Object {
|
||||
@@ -25,14 +25,14 @@ function Invoke-MsPrivateGroupPlan {
|
||||
$dependencyEntry=@($entries | Where-Object { $_.Id -ceq $dependency })
|
||||
$dependencyEntry.Count -ne 1 -or $dependencyEntry[0].Status -ne 'Succeeded'
|
||||
})
|
||||
if($blocked.Count){$entry.Status='SkippedDependency';$entry.Error='Required group did not succeed: '+($blocked-join', ');&$save;continue}
|
||||
$entry.Status='Running';&$save;if($OnProgress){&$OnProgress $entry}
|
||||
if($blocked.Count){$entry.Status='SkippedDependency';$entry.Error='Required group did not succeed: '+($blocked-join', ');if($ReportPath){Write-MsPrivateJsonAtomic -InputObject $report -Path $ReportPath -Depth 8};continue}
|
||||
$entry.Status='Running';if($ReportPath){Write-MsPrivateJsonAtomic -InputObject $report -Path $ReportPath -Depth 8};if($OnProgress){&$OnProgress $entry}
|
||||
try{& $group.Action|Out-Host;$entry.Status='Succeeded'}catch{$entry.Status='Failed';$entry.Error=$_.Exception.Message}
|
||||
&$save
|
||||
if($ReportPath){Write-MsPrivateJsonAtomic -InputObject $report -Path $ReportPath -Depth 8}
|
||||
}
|
||||
$failed=@($entries | Where-Object { $_.Status -eq 'Failed' }).Count
|
||||
$skipped=@($entries | Where-Object { $_.Status -eq 'SkippedDependency' }).Count
|
||||
$report.Status=if($failed-or$skipped){'PartialFailure'}else{'Completed'};$report.CompletedUtc=[DateTime]::UtcNow.ToString('o');&$save
|
||||
$report.Status=if($failed-or$skipped){'PartialFailure'}else{'Completed'};$report.CompletedUtc=[DateTime]::UtcNow.ToString('o');if($ReportPath){Write-MsPrivateJsonAtomic -InputObject $report -Path $ReportPath -Depth 8}
|
||||
$report
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user