feat(site): implement preview URL generation #321
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!321
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/preview-url"
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 URL generation using the path-based format
https://{host}/preview/{branch}, matching the preview Ingress routing:KubernetesService.PreviewURL(s, branch)and theClientimplementation build the URL from the site host (custom domain if set, else<name>.<base_domain>), producing e.g.https://blog.pages.example.com/preview/test/foo.SiteService.PreviewURL(siteName, branch)resolves the site (returningErrNotFoundfor unknown sites) and delegates to the Kubernetes layer.KubernetesClientstructural interface extended withPreviewURL.Why
Phase 6 task #88 — completes the Preview Deployments phase; the URL lets operators (and future API responses) link directly to a preview deployment.
Testing
go build ./...go vet ./...go test -race ./...— kubernetes URL builder (default + custom domain hosts), site service (happy path + unknown site); full suite passesgofmt -l ./cmd ./internal ./pkgcleangolangci-lint run— 0 issuesBreaking Changes
None.
Notes
/preview/{branch}.Closes #87
Closes #88
Review Summary
Verified locally on the PR head (
a7239a3):go build,go vet,gofmt,golangci-lint runall clean; full suite passes with-race(kubernetes URL builder + site service URL tests).Clean, minimal implementation.
PreviewURLproduceshttps://{host}/preview/{branch}using the samesiteHost(custom domain preferred, else<name>.<base_domain>) and the same/preview/{branch}path that the preview Ingress routes, so the generated URL always matches the actual routing. Keeping the Kubernetes-level builder pure (noctx/error — it's string formatting) and wrapping it inSiteService.PreviewURLfor site resolution +ErrNotFoundis the right split. All structural interface fakes updated, so everything compiles.No blocking issues.
Non-blocking observations:
?,#, spaces, etc.), so branches are safe as-is.https://. Fine given the roadmap's TLS approach (ingress controller terminates), worth keeping in mind if a plain-HTTP deployment is ever supported.Approving.