Migrate remaining legacy operator workflows
This commit is contained in:
@@ -9,52 +9,58 @@ param(
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
if (-not [IO.Path]::IsPathRooted($CutRoot)) {
|
||||
throw 'CutRoot must be an absolute path.'
|
||||
$modulePath = Join-Path $PSScriptRoot 'LegacyCutCoverage.psm1'
|
||||
$manifestPath = Join-Path $PSScriptRoot 'LegacyCutRequirements.json'
|
||||
Import-Module -Name $modulePath -Force
|
||||
|
||||
if (-not (Test-Path -LiteralPath $manifestPath -PathType Leaf)) {
|
||||
throw 'The closed legacy cut requirement manifest is missing.'
|
||||
}
|
||||
|
||||
$root = [IO.Path]::GetFullPath($CutRoot)
|
||||
if (-not (Test-Path -LiteralPath $root -PathType Container)) {
|
||||
throw 'CutRoot does not identify an existing directory.'
|
||||
$manifest = Get-Content -LiteralPath $manifestPath -Raw -Encoding UTF8 | ConvertFrom-Json
|
||||
if ($manifest.schemaVersion -ne 1 -or
|
||||
$manifest.reachableBuilders -le 0 -or
|
||||
@($manifest.activeAliases).Count -eq 0 -or
|
||||
@($manifest.assets).Count -eq 0) {
|
||||
throw 'The closed legacy cut requirement manifest is invalid.'
|
||||
}
|
||||
|
||||
# Active MainForm aliases for the 34 reachable builders. s8086 intentionally has no alias.
|
||||
$aliases = @(
|
||||
'5001', 'N5001', '5006', '5011', '5016', '50160',
|
||||
'5023', '5024', '5025', '5026', '5029',
|
||||
'8018', '8032', '5032', '5037',
|
||||
'5074', '5076', '5077', '5078', '5079',
|
||||
'5080', '5081', '5082', '5083', '5084', '5085',
|
||||
'5086', '50860', '5087', '5088',
|
||||
'6001', '6067', '8001', '8002', '8003',
|
||||
'8035', '8061', '8040', '8046', '8051', '8056',
|
||||
'8067', '5068', '5070', '5072'
|
||||
)
|
||||
$report = Test-LegacyCutCoverageState `
|
||||
-CutRoot $CutRoot `
|
||||
-Aliases @($manifest.activeAliases) `
|
||||
-AssetRequirements @($manifest.assets) `
|
||||
-ReachableBuilders $manifest.reachableBuilders
|
||||
|
||||
$missing = [Collections.Generic.List[string]]::new()
|
||||
$unsafe = [Collections.Generic.List[string]]::new()
|
||||
foreach ($alias in $aliases) {
|
||||
$path = Join-Path $root ($alias + '.t2s')
|
||||
if (-not (Test-Path -LiteralPath $path -PathType Leaf)) {
|
||||
$missing.Add($alias)
|
||||
continue
|
||||
}
|
||||
|
||||
$item = Get-Item -LiteralPath $path -Force
|
||||
if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0 -or
|
||||
$item.Length -le 0) {
|
||||
$unsafe.Add($alias)
|
||||
}
|
||||
$failedAliases = @($report.AliasFindings | Where-Object Status -ne 'Present')
|
||||
$failedAssets = @($report.AssetFindings | Where-Object Status -ne 'Present')
|
||||
foreach ($finding in $failedAliases) {
|
||||
Write-Warning ("CutAlias {0} ({1}) => {2}" -f
|
||||
$finding.Alias,
|
||||
$finding.RelativePath,
|
||||
$finding.Status)
|
||||
}
|
||||
foreach ($finding in $failedAssets) {
|
||||
Write-Warning ("BuilderAsset {0} {1} ({2}) => {3}" -f
|
||||
$finding.Builder,
|
||||
$finding.Kind,
|
||||
$finding.RelativePath,
|
||||
$finding.Status)
|
||||
}
|
||||
|
||||
if ($missing.Count -ne 0 -or $unsafe.Count -ne 0) {
|
||||
throw "Legacy cut coverage failed. Missing=$($missing.Count), Unsafe=$($unsafe.Count)."
|
||||
}
|
||||
|
||||
[pscustomobject][ordered]@{
|
||||
Status = 'Passed'
|
||||
ReachableBuilders = 34
|
||||
ActiveAliases = $aliases.Count
|
||||
Missing = $missing.Count
|
||||
Unsafe = $unsafe.Count
|
||||
$report
|
||||
if ($report.Status -ne 'Passed') {
|
||||
$assetSummary = @($failedAssets | ForEach-Object {
|
||||
"{0}|{1}|{2}|{3}" -f $_.Builder, $_.Kind, $_.RelativePath, $_.Status
|
||||
}) -join '; '
|
||||
$messageFormat = "Legacy cut coverage failed. Missing={0}, Unsafe={1}, " +
|
||||
"MissingAssets={2}, UnsafeAssets={3}, RootEscapes={4}, " +
|
||||
"ReparseAssets={5}. AssetFindings=[{6}]"
|
||||
throw ($messageFormat -f
|
||||
$report.Missing,
|
||||
$report.Unsafe,
|
||||
$report.MissingAssets,
|
||||
$report.UnsafeAssets,
|
||||
$report.RootEscapes,
|
||||
$report.ReparseAssets,
|
||||
$assetSummary)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user