feat(site): implement preview deployment support #144
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/thwap-pagesd!144
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/preview-deployments"
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?
What
Add preview deployments for pushes to
test/*branches:internal/webhook) —IsBranch/BranchName/IsTag/IsPreviewBranchdistinguish branch pushes from tag pushes and match thetest/*pattern (#79, #80).internal/webhook/receiver.go) —test/*branch pushes route toSiteService.PublishPreviewwhen the site hasPreviewEnabled; all other pushes (tags, other branches) route to productionPublish(#81).SiteService.PublishPreview— deploys the branch by creating the preview Ingress viaKubernetesService.CreatePreviewIngress(path-based/preview/<branch>routing on the site host, #82) and records an activeDeploymentwith the branch as the version.KubernetesClientstructural interface extended withCreatePreviewIngress(satisfied by the concrete client).Why
Phase 6 task #83 — lets users preview site changes on
test/*branches alongside the production deployment.Testing
go build ./...go vet ./...go test -race ./...— ref classification (4 subtests), receiver routing (preview push, preview-disabled, tag push),PublishPreview(happy path, preview-disabled); full suite passesgofmt -l ./cmd ./internal ./pkgcleangolangci-lint run— 0 issuesBreaking Changes
None.
Notes
Closes #79
Closes #80
Closes #81
Closes #82
Closes #83
Review Summary
Verified locally on the PR head (
c6a1e32):go build,go vet,gofmt,golangci-lint runall clean; full suite passes with-race(ref classification, receiver routing, PublishPreview + existing).Solid, well-factored implementation. The ref-classification helpers (
IsBranch/BranchName/IsTag/IsPreviewBranch) are simple and correct, and the receiver routing cleanly separatestest/*branch pushes (→PublishPreview, silent no-op when the site has previews disabled) from everything else (→ productionPublish).PublishPreviewcorrectly guards onPreviewEnabled(defensive, since the receiver pre-checks), and records the branch as the deployment version. TheKubernetesClientstructural interface extension matches the concrete client's existingCreatePreviewIngress, so the compile-time assertion still holds. Test coverage is good — the receiver-routing tests assert the right service method is called (and the wrong one isn't).No blocking issues.
Non-blocking observations:
main) still route to productionPublish, re-selecting the highestv*tag — pre-existing behavior carried over from #142, still worth filtering to tag refs eventually.deletedflag in Forgejo push payloads isn't parsed yet, so deleted branches leave stale preview ingresses until that lands. Expected, not blocking.Approving.