Show what a deploy is doing while it packs and uploads #21
No reviewers
Labels
No labels
⏳in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grey.ooo/someones.computer_agent!21
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/sc-deploy-live-progress"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
sc deploysaid almost nothing while it worked: silence until packing had finished, a tumbling spinner for the whole upload, and a bare uuid at the end. All three had the machinery already in place and unused.This is the local half of giving a deploy real feedback. Following the remote half — build and rollout — needs a platform endpoint and is #293; the
uiprimitives added here are what that will draw with.What changed
Packing ran before the header. Walking and gzipping every build context is the longest local step of a deploy, and it happened before the command had printed so much as which application it had settled on. The header now prints first, and
bundle.Loadtakes a callback so the spinner names the context currently costing the wait.The upload gauge was dead code.
ui.Spinnerhas had an eight-step fill gauge for a measured wait since it was written, andupload.Bundletook aProgressFuncits own docblock described as never called — the multipart was assembled in one piece, so there was no moment between "nothing sent" and "all sent" to report. It now writes the body through anio.Pipeand counts it past in bounded chunks.Two things that are easy to get wrong here and are worth a reviewer's eye:
io.Discard. Not for the gauge's denominator — forContent-Length. The platform refuses an oversized bundle from that header alone, and a chunked upload would turn a courteous 413 into 512 MiB sent and then refused. Both passes share one boundary, andTestBundleSendsEveryPartTheMeasuringPassCountedparses what actually arrived to prove they agree.multiparthands over a whole tarball perWrite, so a counter that ticked once per call reported one step per part. I only caught this by running it — the first recording went⡀→⣶→ done with nothing in between.The closing line dropped the link. The bundle endpoint has returned an absolute
urlfor the revision's page since #292 closed, andupload.Deploymentnever had the field, soscparsed the response and threw it away.docs/agent-cli.mdhas meanwhile claimed that url "is whatsc deployprints as its closing line". Now it is.internal/uigrew three primitives, all needed by the live build view in #293 and all useful now:Println(a durable line above a running spinner — erase, write, let the tick redraw, under the mutexdrawalready holds, which is what will let build output scroll past something still spinning),Fail(the landed die in red brackets, with the colour deliberately an accent so aNO_COLORterminal and a CI log read identically — hence its summary must say what went wrong in words), and an opt-in elapsed clock. Frames are now erased rather than overdrawn, so a label that shrinks leaves no tail.What it looks like
Before — nothing at all until packing finished, then a tumble, then a uuid:
After — distinct frames from one recorded run against a throttled stand-in platform, 17.2 MiB over two contexts:
The gauge climbing and then handing back to the tumble is the intended behaviour, not a glitch: once the bytes are gone there is nothing left to measure and the wait belongs to the far end.
Off a terminal it degrades to plain text with no escape codes, which is what a CI log wants:
Verified
go build ./...,go vet ./...,gofmt -l internal/ cmd/clean.go test ./...green;go test -race -count=3 ./internal/ui/green, sincePrintlnanddrawcontend for the same mutex.--dry-runagainstexample-app/, on a pty and redirected.Not in scope
Following the deploy past
pending— the build and rollout status, and streaming kaniko's output — is #293 and needs the platform endpoint first.--detachand--no-build-logsland with it, since there is nothing yet to detach from or suppress.WIP: Show what a deploy is doing while it packs and uploadsto Show what a deploy is doing while it packs and uploads