fix(lab): probe optional adapter image safely

This commit is contained in:
DCCONSTRUCTIONS
2026-08-31 19:52:34 +03:00
parent b2ae29b8d8
commit 142481f0d8
2 changed files with 11 additions and 3 deletions
@@ -132,9 +132,15 @@ function Install-ComponentImage {
}
$shortRevision = $SourceRevision.Substring(0, 12)
$tag = "ndc/mission-core-lab-v1-$Component-adapter:$shortRevision"
$existing = docker image inspect $tag 2>$null
if ($LASTEXITCODE -eq 0) {
$image = @($existing | ConvertFrom-Json)[0]
$existingId = docker image ls `
--quiet `
--no-trunc `
--filter "reference=$tag"
if ($LASTEXITCODE -ne 0) {
throw "LAB V1 component image lookup failed"
}
if ($existingId) {
$image = Get-ImageInspection $tag
$labels = $image.Config.Labels
if (
[string]$labels."org.opencontainers.image.revision" -cne $SourceRevision -or
@@ -19,6 +19,8 @@ def test_component_image_installer_is_exact_local_and_offline() -> None:
assert "--security-opt no-new-privileges" in script
assert "target=/nodedc-build-source,readonly" in script
assert "Get-FileSha256" in script
assert 'docker image ls `' in script
assert '--filter "reference=$tag"' in script
assert "Invoke-InstalledImageSmoke" in script
assert "docker commit @changes $containerId $tag" in script
assert "docker rm -f $containerId" in script