Repository navigation
Description
Filed for review. Scope and approach not yet confirmed.
A documented, end-to-end story for short-lived per-PR deployments: open a PR, get an isolated live copy of the stack; close the PR, it is gone.
Finding
chant has every ingredient — CI lexicons (github/gitlab/forgejo) to declare the workflow, build-time parameters to vary a build per environment, ApplyOp to apply, ownership markers for isolation — but nothing assembles them, and no docs page mentions per-PR environments. Searched issues and docs: no existing story.
Want
1. The recipe, as a tutorial
One docs page (guide or tutorial) covering the loop:
- PR opened/updated →
chant build --env pr-<n>(env-scoped names via feat(core): environment-scoped resource naming — one stack, many coexisting instances #1221) → gated-or-additiveApplyOp→ post/update a sticky PR comment with the stack outputs (endpoint URL etc.). - PR closed → teardown of
pr-<n>(feat(lifecycle): marker-scoped environment teardown — delete what a stack owns in an env, statelessly #1222), with a guard refusing to tear down long-lived env names. - Works on all three CI lexicons; the workflow itself is declared in chant and emitted by
chant build(dogfood).
2. A composite, if the recipe warrants it
If the workflow shape is stable across CI targets, ship it as a composite in each CI lexicon (working name PreviewEnvironmentWorkflow({ stack, applyOp, teardownOp })) that emits the on-open / on-sync / on-close jobs. Start with the tutorial; promote to composite only when the copy-paste is proven.
3. Dynamic env names
environments is a static list; pr-<n> is unbounded. Decide the contract — either allow a pattern entry ({ pattern: "pr-*" }) or allow --env values outside the list for build/teardown with a warning. Needs a decision, flagging explicitly for review.
Acceptance
- Tutorial builds in CI like other examples; the emitted workflow passes the CI lexicon's own lint (pinned actions etc.).
- Runtime proof on one CI target via the existing runtime E2E harness (
just gitlab-runtime-e2eor forgejo), against an emulator env. - PR comment updates in place across pushes (stable identity), not one comment per push.
- Explicitly documents cost/limits: per-PR copies are real resources; which resource kinds are too heavy to clone per PR.
Activity
lex00 commentedon Aug 24, 2026
Scope confirmed (build, modified). Verified against current code; two premises moved since filing.
Already exists, shrinks v1: gitlab
ReviewAppand githubDeployEnvironmentcomposites carry the deploy/stop job shape;chant build --env+--paramexist; and #1396 (PR #1788) madeownership.envresolve from the env build parameter, so per-PR ownership markers already work. The real gaps: dynamic env names (pr-<n>) are rejected byunknownEnvErroragainst the staticenvironmentslist, there is no teardown verb, and no sticky-comment machinery.V1 = docs + example for the GitHub dialect, runtime-proven on the forgejo harness (thin github dialect, locally provable; no
actintegration). PR open/update →chant build --param env=pr-<n>(names via #1221, marker via #1396) → ApplyOp local executor → sticky PR comment via a scriptedgh apistep keyed on a marker string (no marketplace action, passes the pinned-actions lints). PR close → #1222 teardown with the long-lived-env guard. The workflow itself is declared in chant and emitted bychant build. Cost/limits section as filed.Out: gitlab/forgejo tutorial parity (gitlab users pointed at
ReviewApp), aPreviewEnvironmentWorkflowcomposite (follow-up if the copy-paste proves stable), any dynamic-env machinery here (that contract is decided once, in #1221 —pr-*and #1224'stest-*-<nonce>are the same case), component-pipeline integration.Blocked on: #1221 (dynamic-env legality +
envName()), #1222 (CI-runnable non-interactive teardown, loud-but-zero on empty, refuse-long-lived-env guard).Plan: PR A tutorial example + docs page (GitHub dialect, GHA lints clean); PR B forgejo runtime-E2E fixture proving on-open deploy and on-close teardown against an emulator env.
feat(examples): per-PR preview environments — tutorial + example on t…
test(forgejo): runtime E2E for the per-PR preview loop — deploy on op…