nice-to-have: implement all 6 tier items
- Get-CIJobSummary.ps1: already present with full implementation (marked done) - Get-BuildArtifacts.ps1: add -JobId/-Commit params; Write-ArtifactManifest writes manifest.json (name, size, sha256, commit, jobId) after both Linux and Windows artifact collection branches - Invoke-CIJob.ps1: add -GuestCPU/-GuestMemoryMB params; insert post-clone VMX override block (numvcpus/memsize rewrite) before vmrun start; pass -JobId/-Commit to Get-BuildArtifacts calls - Watch-RunnerHealth.ps1: add -GiteaUrl/-GiteaCredentialTarget params; optional GET /api/v1/admin/runners check in Running branch warns if 0 online runners - Install-CIToolchain-WinBuild2025.ps1: fill SHA256 hashes for Python 3.13.3, 7-Zip 26.01, Node.js 22.14.0, dotnet-install.ps1 - Measure-CIBenchmark.ps1: add deltaKB field (linked-clone disk footprint in KB) measured post-clone; added to result object and summary Format-Table
This commit is contained in:
@@ -65,7 +65,13 @@ param(
|
||||
|
||||
# Persistent known_hosts file for SSH calls (CI jobs).
|
||||
# Empty string (default) = permissive mode (StrictHostKeyChecking=no, UserKnownHostsFile=NUL).
|
||||
[string] $SshKnownHostsFile = ''
|
||||
[string] $SshKnownHostsFile = '',
|
||||
|
||||
# Optional job ID and commit SHA written into manifest.json.
|
||||
# When either is non-empty a manifest.json is written to $HostArtifactDir
|
||||
# listing all collected files with name, size, and SHA256.
|
||||
[string] $JobId = '',
|
||||
[string] $Commit = ''
|
||||
)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
@@ -73,6 +79,34 @@ $ErrorActionPreference = 'Stop'
|
||||
|
||||
Import-Module (Join-Path $PSScriptRoot '_Common.psm1') -Force
|
||||
|
||||
# ── Helper: write artifact manifest ─────────────────────────────────────────
|
||||
function Write-ArtifactManifest {
|
||||
param([string] $Dir, [string] $JobId, [string] $Commit)
|
||||
$files = @(Get-ChildItem -Path $Dir -Recurse -File -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.Name -ne 'manifest.json' })
|
||||
$fileEntries = foreach ($f in $files) {
|
||||
[pscustomobject]@{
|
||||
name = $f.FullName.Substring($Dir.TrimEnd('\', '/').Length).TrimStart('\', '/')
|
||||
size = $f.Length
|
||||
sha256 = (Get-FileHash $f.FullName -Algorithm SHA256).Hash.ToLower()
|
||||
}
|
||||
}
|
||||
$manifest = [ordered]@{
|
||||
ts = (Get-Date -Format 'o')
|
||||
jobId = $JobId
|
||||
commit = $Commit
|
||||
files = @($fileEntries)
|
||||
}
|
||||
$manifestPath = Join-Path $Dir 'manifest.json'
|
||||
try {
|
||||
$manifest | ConvertTo-Json -Depth 4 |
|
||||
Set-Content -Path $manifestPath -Encoding UTF8 -Force -ErrorAction Stop
|
||||
Write-Host "[Get-BuildArtifacts] Manifest written: $manifestPath ($($files.Count) file(s))"
|
||||
} catch {
|
||||
Write-Warning "[Get-BuildArtifacts] Could not write manifest.json: $_"
|
||||
}
|
||||
}
|
||||
|
||||
if ($GuestOS -eq 'Windows' -and $null -eq $Credential) {
|
||||
throw "Credential is required when GuestOS is Windows."
|
||||
}
|
||||
@@ -103,6 +137,9 @@ if ($GuestOS -eq 'Linux') {
|
||||
throw "[Get-BuildArtifacts] No files found in $HostArtifactDir after SCP transfer."
|
||||
}
|
||||
Write-Host "[Get-BuildArtifacts] $($transferred.Count) file(s) collected from Linux guest."
|
||||
if ($JobId -ne '' -or $Commit -ne '') {
|
||||
Write-ArtifactManifest -Dir $HostArtifactDir -JobId $JobId -Commit $Commit
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -180,6 +217,9 @@ try {
|
||||
$sizeKB = [math]::Round($fileItem.Length / 1KB, 1)
|
||||
|
||||
Write-Host "[Get-BuildArtifacts] Artifact collected: $hostDestPath ($sizeKB KB)"
|
||||
if ($JobId -ne '' -or $Commit -ne '') {
|
||||
Write-ArtifactManifest -Dir $HostArtifactDir -JobId $JobId -Commit $Commit
|
||||
}
|
||||
return $hostDestPath
|
||||
}
|
||||
finally {
|
||||
|
||||
Reference in New Issue
Block a user