fix(lab): probe optional adapter image safely
This commit is contained in:
+9
-3
@@ -132,9 +132,15 @@ function Install-ComponentImage {
|
|||||||
}
|
}
|
||||||
$shortRevision = $SourceRevision.Substring(0, 12)
|
$shortRevision = $SourceRevision.Substring(0, 12)
|
||||||
$tag = "ndc/mission-core-lab-v1-$Component-adapter:$shortRevision"
|
$tag = "ndc/mission-core-lab-v1-$Component-adapter:$shortRevision"
|
||||||
$existing = docker image inspect $tag 2>$null
|
$existingId = docker image ls `
|
||||||
if ($LASTEXITCODE -eq 0) {
|
--quiet `
|
||||||
$image = @($existing | ConvertFrom-Json)[0]
|
--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
|
$labels = $image.Config.Labels
|
||||||
if (
|
if (
|
||||||
[string]$labels."org.opencontainers.image.revision" -cne $SourceRevision -or
|
[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 "--security-opt no-new-privileges" in script
|
||||||
assert "target=/nodedc-build-source,readonly" in script
|
assert "target=/nodedc-build-source,readonly" in script
|
||||||
assert "Get-FileSha256" 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 "Invoke-InstalledImageSmoke" in script
|
||||||
assert "docker commit @changes $containerId $tag" in script
|
assert "docker commit @changes $containerId $tag" in script
|
||||||
assert "docker rm -f $containerId" in script
|
assert "docker rm -f $containerId" in script
|
||||||
|
|||||||
Reference in New Issue
Block a user