Preview every pull request's client at pr-N.preview.<domain> #9
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Follow-up to #7 (CI now uploads
client/distas theclient-distartifact, readable without a token).Goal
Every open pull request into
maingets its client build served athttps://pr-N.preview.<domain>/, talking to the demo's homeserver. Nothing on the host runs from a workflow, and nothing from the pull request runs on the host: the host fetches the already-built static files.Design
New directory
docs/preview/(set up likedocs/traefik/), run by the demo's user:fetch.sh, run in a throwaway container (Alpine + jq; busybox wget/unzip), no Docker socket, read-only root, all capabilities dropped,/tmpa size-limited tmpfs. It lists open pull requests intomainthrough the API, finds the latest successfulci.ymlrun for each head commit and itsclient-distartifact, and when that changed:index.html;config.json(demo homeserver, no push gateway) and a public_preview.json(pull request, commit, run) so reviewers can see which commit they are looking at;Previews of closed pull requests are deleted. At most
PREVIEW_MAX(default 5) previews, most recently updated first. An optionalPREVIEW_AUTHORSlimits previews to listed authors; runs that needed approval only exist once a maintainer approved them.sync.shon the host: runs the fetch container, then builds the Traefik ruleHost(pr-N.…) || …from the preview directories and (re)creates the nginx container with it, or removes the container when there are none. Per-host rules let the demo's Traefik get each certificate through TLS-ALPN, so no wildcard certificate and no DNS API token.nginx.conf.template) servespr-Nfrom a read-only mount, with the client's caching rules and headers set by the server, which a pull request cannot change: a CSP (connect-srclimited to the demo homeserver,form-action 'self',frame-ancestors 'none', …),X-Robots-Tag: noindex,Referrer-Policy: no-referrer. Dotfiles are not served.Outside this repository: a DNS-only wildcard record
*.preview.<domain>and anHostSNIRegexpon the front proxy's passthrough route (koto-edge example updated alongside).Security notes (for the README)
koto-demorunner label (any pull request workflow can request it); that is a separate issue.Out of scope
Posting the URL on the pull request (needs a write token), push notifications in previews, server-side (
server/) changes.