accept empty Docker port bindings in M4.7 preflight

This commit is contained in:
DCCONSTRUCTIONS
2026-08-23 20:21:43 +03:00
parent 3d3c0eced2
commit cbbaea9148
2 changed files with 8 additions and 2 deletions
+6 -2
View File
@@ -136,6 +136,10 @@ function Write-Utf8NoBom([string]$Path, [string]$Value) {
[IO.File]::WriteAllText($Path, $Value, $encoding) [IO.File]::WriteAllText($Path, $Value, $encoding)
} }
function Test-NoPublishedPorts([object]$Container) {
return @($Container.HostConfig.PortBindings.PSObject.Properties).Count -eq 0
}
if ($env:COMPUTERNAME -cne "DESKTOP-OPJ8J04") { if ($env:COMPUTERNAME -cne "DESKTOP-OPJ8J04") {
throw "M4.7 shadow release is pinned to DESKTOP-OPJ8J04" throw "M4.7 shadow release is pinned to DESKTOP-OPJ8J04"
} }
@@ -388,7 +392,7 @@ try {
$tritonCandidate.Id -cne $tritonCandidateId -or $tritonCandidate.Id -cne $tritonCandidateId -or
$tritonCandidate.Image -cne $descriptor.container.image_id -or $tritonCandidate.Image -cne $descriptor.container.image_id -or
-not $tritonCandidate.HostConfig.ReadonlyRootfs -or -not $tritonCandidate.HostConfig.ReadonlyRootfs -or
$null -ne $tritonCandidate.HostConfig.PortBindings -not (Test-NoPublishedPorts $tritonCandidate)
) { ) {
throw "M4.7 isolated Triton contract changed" throw "M4.7 isolated Triton contract changed"
} }
@@ -407,7 +411,7 @@ try {
$candidate.Image -cne $descriptor.container.image_id -or $candidate.Image -cne $descriptor.container.image_id -or
$candidate.HostConfig.NetworkMode -cne ("container:{0}" -f $tritonCandidate.Id) -or $candidate.HostConfig.NetworkMode -cne ("container:{0}" -f $tritonCandidate.Id) -or
-not $candidate.HostConfig.ReadonlyRootfs -or -not $candidate.HostConfig.ReadonlyRootfs -or
$null -ne $candidate.HostConfig.PortBindings -not (Test-NoPublishedPorts $candidate)
) { ) {
throw "M4.7 graph candidate isolation contract changed" throw "M4.7 graph candidate isolation contract changed"
} }
@@ -132,3 +132,5 @@ def test_m47_runner_calls_only_the_canonical_graph_entrypoint() -> None:
assert 'Write-Output "DURABLE_WORKER_ACTION=none"' in runner assert 'Write-Output "DURABLE_WORKER_ACTION=none"' in runner
assert 'Write-Output "HISTORICAL_TRITON_ACTION=none"' in runner assert 'Write-Output "HISTORICAL_TRITON_ACTION=none"' in runner
assert 'Write-Output "ISOLATED_TRITON_ACTION=removed"' in runner assert 'Write-Output "ISOLATED_TRITON_ACTION=removed"' in runner
assert "function Test-NoPublishedPorts" in runner
assert "PortBindings.PSObject.Properties" in runner