Files
NODEDC_MISSION_CORE/simulation/ai-polygon/navigation/Prepare-SnapshotNavigation.ps1
T
DCCONSTRUCTIONS d0e5f90952 Preserve installed operator workspace before consolidation
Local preservation snapshot, not a new deployment or simulation acceptance.
2026-10-08 09:59:51 +03:00

20 lines
1.6 KiB
PowerShell

param([string]$Root = 'D:\NDC_MISSIONCORE\runtime\simulation')
$ErrorActionPreference = 'Continue'
$base = 'sha256:aa077bc9177c6b6a8d1bae46c3795e8e38bdd919d324d354d73be7ca5733eaf8'
$actual = docker image inspect 'ndc-ai-polygon-cmu:direction-v1' --format '{{.Id}}'
if ($LASTEXITCODE -ne 0 -or $actual.Trim() -ne $base) { throw 'Pinned direction-v1 CMU image required' }
$existing = docker image inspect 'ndc-ai-polygon-cmu:snapshot-v1' --format '{{.Id}}' 2>$null
if ($LASTEXITCODE -eq 0) { throw 'Snapshot image exists; inspect its evidence before rebuilding' }
$endpoint = docker context inspect --format '{{.Endpoints.docker.Host}}'
if ($LASTEXITCODE -ne 0) { throw 'Docker endpoint unavailable' }
$config = Join-Path $Root 'state\snapshot-public-build'
New-Item -ItemType Directory -Force $config | Out-Null
[IO.File]::WriteAllText((Join-Path $config 'config.json'), '{"auths":{"https://index.docker.io/v1/":{}}}')
$env:DOCKER_CONFIG = $config
$env:BUILDX_CONFIG = Join-Path $config 'buildx'
docker --config $config --host $endpoint.Trim() build --progress plain -t ndc-ai-polygon-cmu:snapshot-v1 -f (Join-Path $PSScriptRoot 'Dockerfile.snapshot') $PSScriptRoot
if ($LASTEXITCODE -ne 0) { throw 'Snapshot build failed' }
$image = docker --config $config --host $endpoint.Trim() image inspect ndc-ai-polygon-cmu:snapshot-v1 --format '{{.Id}}'
if ($LASTEXITCODE -ne 0) { throw 'Built image unavailable' }
@{base_image=$base; image=$image.Trim(); source_sha256=(Get-FileHash (Join-Path $PSScriptRoot 'patch_snapshot.py') -Algorithm SHA256).Hash.ToLower(); built_at=[DateTime]::UtcNow.ToString('o'); rollback_image=$base} | ConvertTo-Json