fix(zdeploy): report where a domain-less project deployed to

Closes #39.

A project without a public domain finished with no indication of where it went
- the 'Site:' line was gated on $Proj.domain in all four handlers, so an
internal service deployed successfully and said nothing about the result.

The information was never missing, only unused: a domain-less project that
deploys almost certainly has a verify block (the documented pattern for stacks
not published through the edge proxy), carrying the exact port and health path
the deploy had just checked. zdeploy verified against that endpoint and then
discarded it.

New Write-DeployLocation falls back through what the project actually declares:
domain -> public URL; else verify.port (+ path) -> server-local URL flagged as
not publicly routed; else ports.prod -> same without a path; else prints
nothing, as before. Replaces the four call sites, keeping the nextjs handler's
column alignment via -Pad.

Exercised against every shape: domain, verify-only, ports.prod-only, nothing at
all, and padded. CHECKSUMS regenerated; suite 219/219.
This commit is contained in:
KellyMichels 2026-08-06 11:45:54 -05:00
parent 4668404378
commit 255d1c769a
2 changed files with 27 additions and 5 deletions

View File

@ -8,7 +8,7 @@ c336a61cb8563736bd6550671d7dc90b14702a43f25a97b1ac15ffd64605fbf6 zbackup_ec2.cm
20e6282901a919aa32ea717c739ba2dc9657426dff860f0e5fce201edefd99da zchecksums.cmd 20e6282901a919aa32ea717c739ba2dc9657426dff860f0e5fce201edefd99da zchecksums.cmd
692b7b0ff9e51e5d9b880358b33c54d2db4f967297a5350e154df1ce6f06ebc6 zchecksums.ps1 692b7b0ff9e51e5d9b880358b33c54d2db4f967297a5350e154df1ce6f06ebc6 zchecksums.ps1
b56085112e7c573926a70a58872163b71416d58ce91ea7114b1f5de5fc96c982 zdeploy.cmd b56085112e7c573926a70a58872163b71416d58ce91ea7114b1f5de5fc96c982 zdeploy.cmd
decb37078094d69ee5882375159ef75daa95098869df6fb201f449aa0949e8b8 zdeploy.ps1 3352214fac08cd83242680c0e7f60025c8f132bafb510384d7c7a0fe9a4c5094 zdeploy.ps1
fa817d3bd7bba98b03b411d3c5a82b210d3cca316ac0c9785afa5b4ac5fe0766 zec2.cmd fa817d3bd7bba98b03b411d3c5a82b210d3cca316ac0c9785afa5b4ac5fe0766 zec2.cmd
5f70432af23df3459a98d9ad6a0da723783f2269dd5f5ab8ecdd6366ebc84942 zec2.ps1 5f70432af23df3459a98d9ad6a0da723783f2269dd5f5ab8ecdd6366ebc84942 zec2.ps1
4df94eda29b6f5b2cb6bfa63e0add4d90ea24d936305f36a69988e8dd5d69154 zec2_rotatekeys.cmd 4df94eda29b6f5b2cb6bfa63e0add4d90ea24d936305f36a69988e8dd5d69154 zec2_rotatekeys.cmd

View File

@ -277,6 +277,28 @@ function Test-DeployHealth {
return $false return $false
} }
# Where the thing just deployed can be reached. A project published through the
# edge proxy has a domain; one that is not still has somewhere to point at, and
# saying nothing is the least useful option — an internal service is exactly the
# case where "where did that land?" is hardest to answer from memory. Falls back
# through what the project actually declares, and prints nothing if it declares
# none of it.
function Write-DeployLocation {
param($Proj, [int]$Pad = 0)
$label = "Site:".PadRight([Math]::Max(5, $Pad))
if ($Proj.domain) {
Write-Host "$label https://$($Proj.domain)" -ForegroundColor Yellow
return
}
# No public route: give the server-local endpoint the deploy just verified.
$port = if ($Proj.verify -and $Proj.verify.port) { [int]$Proj.verify.port }
elseif ($Proj.ports -and $Proj.ports.prod) { [int]$Proj.ports.prod }
else { 0 }
if ($port -le 0) { return }
$path = if ($Proj.verify -and $Proj.verify.path) { [string]$Proj.verify.path } else { "" }
Write-Host "$label http://127.0.0.1:$port$path (on the server; no public domain)" -ForegroundColor Yellow
}
# ── Kind handlers ──────────────────────────────────────────────────────────── # ── Kind handlers ────────────────────────────────────────────────────────────
function Invoke-PythonDeploy { function Invoke-PythonDeploy {
@ -382,7 +404,7 @@ function Invoke-PythonDeploy {
$Elapsed = (Get-Date) - $DeployStart $Elapsed = (Get-Date) - $DeployStart
$ElapsedStr = "{0:mm\:ss}" -f $Elapsed $ElapsedStr = "{0:mm\:ss}" -f $Elapsed
Write-Host "`n--- [Done] $($Proj.label) deployed! ---" -ForegroundColor Green Write-Host "`n--- [Done] $($Proj.label) deployed! ---" -ForegroundColor Green
if ($Proj.domain) { Write-Host "Site: https://$($Proj.domain)" -ForegroundColor Yellow } Write-DeployLocation -Proj $Proj
if ($BuildVersion) { Write-Host "Build Version: $BuildVersion" -ForegroundColor Magenta } if ($BuildVersion) { Write-Host "Build Version: $BuildVersion" -ForegroundColor Magenta }
Write-Host "Change Note: $ChangeNote" -ForegroundColor Cyan Write-Host "Change Note: $ChangeNote" -ForegroundColor Cyan
Write-Host "Deploy Time: $ElapsedStr ($([math]::Round($Elapsed.TotalSeconds))s)" -ForegroundColor DarkGray Write-Host "Deploy Time: $ElapsedStr ($([math]::Round($Elapsed.TotalSeconds))s)" -ForegroundColor DarkGray
@ -449,7 +471,7 @@ function Invoke-ViteDeploy {
$Elapsed = (Get-Date) - $DeployStart $Elapsed = (Get-Date) - $DeployStart
$ElapsedStr = "{0:mm\:ss}" -f $Elapsed $ElapsedStr = "{0:mm\:ss}" -f $Elapsed
Write-Host "`n--- [Done] $($Proj.label) deployed! ---" -ForegroundColor Green Write-Host "`n--- [Done] $($Proj.label) deployed! ---" -ForegroundColor Green
if ($Proj.domain) { Write-Host "Site: https://$($Proj.domain)" -ForegroundColor Yellow } Write-DeployLocation -Proj $Proj
Write-Host "Change Note: $ChangeNote" -ForegroundColor Cyan Write-Host "Change Note: $ChangeNote" -ForegroundColor Cyan
Write-Host "Deploy Time: $ElapsedStr ($([math]::Round($Elapsed.TotalSeconds))s)" -ForegroundColor DarkGray Write-Host "Deploy Time: $ElapsedStr ($([math]::Round($Elapsed.TotalSeconds))s)" -ForegroundColor DarkGray
} }
@ -551,7 +573,7 @@ function Invoke-NextDeploy {
$Elapsed = (Get-Date) - $DeployStart $Elapsed = (Get-Date) - $DeployStart
$ElapsedStr = "{0:mm\:ss}" -f $Elapsed $ElapsedStr = "{0:mm\:ss}" -f $Elapsed
Write-Host "`n--- [Done] $($Proj.label) deployed! ---" -ForegroundColor Green Write-Host "`n--- [Done] $($Proj.label) deployed! ---" -ForegroundColor Green
if ($Proj.domain) { Write-Host "Site: https://$($Proj.domain)" -ForegroundColor Yellow } Write-DeployLocation -Proj $Proj -Pad 12
Write-Host "Change Note: $ChangeNote" -ForegroundColor Cyan Write-Host "Change Note: $ChangeNote" -ForegroundColor Cyan
Write-Host "Deploy Time: $ElapsedStr ($([math]::Round($Elapsed.TotalSeconds))s)" -ForegroundColor DarkGray Write-Host "Deploy Time: $ElapsedStr ($([math]::Round($Elapsed.TotalSeconds))s)" -ForegroundColor DarkGray
} }
@ -628,7 +650,7 @@ function Invoke-DockerDeploy {
Invoke-Ec2PostDeployCleanup -Label $Key Invoke-Ec2PostDeployCleanup -Label $Key
Write-Host "`n--- [Done] $($Proj.label) deploy finished ---" -ForegroundColor Green Write-Host "`n--- [Done] $($Proj.label) deploy finished ---" -ForegroundColor Green
if ($Proj.domain) { Write-Host "Site: https://$($Proj.domain)" -ForegroundColor Yellow } Write-DeployLocation -Proj $Proj
} }
# ── Dispatch ───────────────────────────────────────────────────────────────── # ── Dispatch ─────────────────────────────────────────────────────────────────