83 lines
3.2 KiB
PowerShell
83 lines
3.2 KiB
PowerShell
$ErrorActionPreference = "Stop"
|
|
|
|
$root = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$releaseRoot = Join-Path $root "release"
|
|
$latestJsonPath = Join-Path $releaseRoot "latest_release.json"
|
|
$finalReportPath = Join-Path $releaseRoot "final_release_report.json"
|
|
|
|
if (-not (Test-Path -LiteralPath $latestJsonPath)) {
|
|
throw "latest_release.json not found"
|
|
}
|
|
|
|
$latest = Get-Content -LiteralPath $latestJsonPath -Raw | ConvertFrom-Json
|
|
$report = $null
|
|
if (Test-Path -LiteralPath $finalReportPath) {
|
|
$report = Get-Content -LiteralPath $finalReportPath -Raw | ConvertFrom-Json
|
|
}
|
|
|
|
$reportOk = $null
|
|
$reportMatchesLatest = $null
|
|
$reportPackageName = ""
|
|
$reportStaleReason = ""
|
|
$finalReleaseOk = $null
|
|
$releaseGateDecision = ""
|
|
$releaseGateBlockedReasons = @()
|
|
$releaseGateVerifyOk = $null
|
|
$releaseGateSmokeTestOk = $null
|
|
|
|
if ($report) {
|
|
$reportOk = [bool]$report.ok
|
|
if ($report.release_gate) {
|
|
$releaseGateDecision = [string]$report.release_gate.decision
|
|
$releaseGateBlockedReasons = @($report.release_gate.blocked_reasons)
|
|
if ($null -ne $report.release_gate.verify_ok) {
|
|
$releaseGateVerifyOk = [bool]$report.release_gate.verify_ok
|
|
}
|
|
if ($null -ne $report.release_gate.smoke_test_ok) {
|
|
$releaseGateSmokeTestOk = [bool]$report.release_gate.smoke_test_ok
|
|
}
|
|
}
|
|
if ($report.latest_release) {
|
|
$reportPackageName = [string]$report.latest_release.package_name
|
|
$mismatches = @()
|
|
$reportArchivePath = if ($report.latest_release.archive_path) { [string]$report.latest_release.archive_path } else { [string]$report.latest_release.zip_path }
|
|
$latestArchivePath = if ($latest.archive_path) { [string]$latest.archive_path } else { [string]$latest.zip_path }
|
|
if ([string]$report.latest_release.package_name -ne [string]$latest.package_name) {
|
|
$mismatches += "package_name"
|
|
}
|
|
if ($reportArchivePath -ne $latestArchivePath) {
|
|
$mismatches += "archive_path"
|
|
}
|
|
if ([string]$report.latest_release.sha256 -ne [string]$latest.sha256) {
|
|
$mismatches += "sha256"
|
|
}
|
|
|
|
$reportMatchesLatest = ($mismatches.Count -eq 0)
|
|
if (-not $reportMatchesLatest) {
|
|
$reportStaleReason = "final_release_report does not match latest_release: $($mismatches -join ', ')"
|
|
}
|
|
}
|
|
else {
|
|
$reportMatchesLatest = $false
|
|
$reportStaleReason = "final_release_report.latest_release missing"
|
|
}
|
|
|
|
$finalReleaseOk = ($reportOk -and $reportMatchesLatest)
|
|
}
|
|
|
|
$summary = [ordered]@{
|
|
latest_release = $latest
|
|
final_release_ok = $finalReleaseOk
|
|
final_release_report = if ($report) { $finalReportPath } else { "" }
|
|
final_release_report_ok = $reportOk
|
|
final_release_report_matches_latest = $reportMatchesLatest
|
|
final_release_report_package_name = $reportPackageName
|
|
final_release_report_stale_reason = $reportStaleReason
|
|
final_release_gate_decision = $releaseGateDecision
|
|
final_release_gate_blocked_reasons = $releaseGateBlockedReasons
|
|
final_release_gate_verify_ok = $releaseGateVerifyOk
|
|
final_release_gate_smoke_test_ok = $releaseGateSmokeTestOk
|
|
}
|
|
|
|
$summary | ConvertTo-Json -Depth 8
|