Add API integration checks, migration compatibility, rolling restart scenarios and a report verification collector.
26 lines
1.5 KiB
PowerShell
26 lines
1.5 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
$dockerInfo = docker info --format '{{json .}}' | ConvertFrom-Json
|
|
if ($LASTEXITCODE -ne 0) { throw 'docker info failed' }
|
|
$processor = Get-CimInstance Win32_Processor | Select-Object -First 1
|
|
$computer = Get-CimInstance Win32_ComputerSystem
|
|
$containers = docker inspect mtusi2026lab2-fork-backend-1 mtusi2026lab2-fork-postgres-1 mtusi2026lab2-fork-redis-1 | ConvertFrom-Json
|
|
if ($LASTEXITCODE -ne 0) { throw 'docker inspect failed' }
|
|
$metadata = [ordered]@{
|
|
recorded_at = [DateTime]::UtcNow.ToString('o')
|
|
host_cpu = $processor.Name
|
|
host_physical_cores = $processor.NumberOfCores
|
|
host_logical_processors = $processor.NumberOfLogicalProcessors
|
|
host_ram_bytes = $computer.TotalPhysicalMemory
|
|
docker_version = $dockerInfo.ServerVersion
|
|
docker_cpu_count = $dockerInfo.NCPU
|
|
docker_ram_bytes = $dockerInfo.MemTotal
|
|
docker_kernel = $dockerInfo.KernelVersion
|
|
containers = @($containers | ForEach-Object {
|
|
[ordered]@{ name = $_.Name; image = $_.Image; memory_limit_bytes = $_.HostConfig.Memory; nano_cpus_limit = $_.HostConfig.NanoCpus; cpu_quota = $_.HostConfig.CpuQuota }
|
|
})
|
|
before_image = 'sha256:075170aed76a42aa98b435cfb918d83879259b7e17177275d5274e328198e119'
|
|
before_image_local_tag = 'lab2-cache-epochs:before'
|
|
}
|
|
$metadataPath = Join-Path (Get-Location).Path 'evidence/cache-epochs-environment.json'
|
|
[System.IO.File]::WriteAllText($metadataPath, ($metadata | ConvertTo-Json -Depth 6) + [Environment]::NewLine, [System.Text.UTF8Encoding]::new($false))
|