1 PR Previews
Finn Dührkop edited this page 2026-10-27 03:34:35 +00:00

PR previews

Platform and lifecycle

  • The preview system is shared: each opted-in repository/PR gets an application and namespace inside the orchard-core virtual cluster, not a separate cluster.
  • A same-repository pull request with the preview label triggers a build and deployment. Fork pull requests are skipped. Removing the label or closing the pull request triggers deletion of the preview application, namespace, and preview data.
  • The bootstrap workflow creates a repository-scoped Argo CD project and repository credentials. Preview image pulls use a namespace-local Secret rather than Argo CD Application parameters.
  • Preview URLs are public and have no Cloudflare Access boundary. The URL path is not an authorization mechanism.

Request path and container contract

  • Preview URLs use https://preview.113lab.dev/<repo-key>/<number>/.
  • Traefik strips the repository/PR path prefix and the KEDA HTTP interceptor routes traffic to the preview workload. The request prefix is forwarded in X-Forwarded-Prefix; the original scheme is carried by X-Forwarded-Proto.
  • The chart defaults to container port 80, HTTP readiness/liveness checks at /, and a Longhorn-backed mount at /app/App_Data.
  • KEDA scales preview workloads from zero to one replica and cools down after 300 seconds. A request to a scaled-down preview can incur a cold-start delay.
  • PREVIEW_ENV_VARS supplies non-secret string-valued settings. The workflow's repository secrets are separate and used for credentials.

ASP.NET Core integration facts

  • ASP.NET Core's built-in forwarded-header middleware does not map X-Forwarded-Prefix to Request.PathBase by itself.
  • URL generation and redirects depend on the application's path-base handling. This includes static assets, media, APIs, forms, and output caches.
  • Orchard Core can use its Reverse Proxy module for forwarded prefix and scheme handling. The trusted network range is an application-specific setting, not a universal value supplied by the preview chart.
  • Orchard Core media URL generation and path-sensitive menu/resource caching have required path-base-aware handling in prior preview work.

Configuration sources

The shared workflow is templates/forgejo-pr-preview/.forgejo/workflows/preview.yml; bootstrap is in .forgejo/workflows/preview-bootstrap.yml and scripts/preview-bootstrap.mjs. Routing and chart behavior are in modules/orchard-vcluster/preview-path-routing.tf, charts/orchard-preview/, and the workflows. The user-facing facts above do not assert that a particular preview is currently deployed.