Skip to main content
Reviewers should be able to open a link on a pull request and see the change running, instead of reading a diff and imagining it. Ankra deploys every pull request on a connected application to your organisation’s staging cluster, keeps one status comment on the pull request up to date, and tears the preview down when the pull request closes. A preview deploys an image that was already built for the pull request. Which image that is depends on how the application is built - see Where the preview image comes from before you rely on previews.

What you get

Once the pull request’s image exists, a comment like this appears and keeps itself up to date:

🚀 Ankra Preview

⏳ Expires Aug 9, 22:26 UTC · 🔁 Redeploys on every push
The preview runs in its own isolated namespace on the staging cluster, PodSecurity-hardened and quota-bounded, exactly like a manually launched preview demo. When the Ankra GitHub App has the optional Deployments permission, the pull request also gets a GitHub deployment entry, so the preview shows up in the pull request’s environments box.

Prerequisites

1

Connect the repository as an application

The repository must be a connected application on GitHub.
2

Make sure pull requests produce an image

An application built with Ankra Pipelines already does: every pull request run builds the head commit. An application built with the generated GitHub Actions workflow does not, because that workflow pushes nothing for a pull request. See Where the preview image comes from.
3

Configure a staging cluster

Someone whose role holds ai.manage (the owner and admin roles do) chooses it under Ankra AI → AI workspaces, in Where workspaces and previews run → Staging cluster. Without it, pull requests deploy nothing however the switch below is set. The same page sets How long a preview lives at first (1 to 720 hours) and the longest each role may keep a preview running.From the CLI:
Check: the application’s Previews view shows a Cluster online badge beside the cluster’s name.
4

Turn pull request previews on

Pull request previews are off on a new GitHub connection, and nothing is deployed until they are on. Turn them on for one application, or for the whole connection:
For one application: go to Applications → your application → Settings → Deploys, and in the Pull requests card switch on Preview every pull request. This needs a role that can configure the application. It applies to that repository only, from the next pull request.For every repository of the connection: someone whose role holds ai.manage goes to Ankra AI → Gateway connections and, in the GitHub installation’s repository table, switches on Pull request previews on the All repositories row or on a rule for one repository. See AI code review.
Check: after you switch it on, the card says “Preview every pull request: on for this repository. It applies to the next pull request.”
5

Optional: bring a preview domain for HTTPS

By default previews are served under the staging cluster’s own Ankra DNS zone (*.ankra.cc, or the Ankra domain your organisation selected). For your own hostnames, someone whose role holds ai.manage sets a Preview domain with its Ingress class and TLS secret under Ankra AI → AI workspaces → Domains for previews.

Where the preview image comes from

Ankra looks for the preview image in one of two ways, depending on what builds the application. The application’s setup pull request decides that: a new application builds with Ankra Pipelines by default. Ship Your App compares the builders.

Applications built with Ankra Pipelines

The preview deploys the image the pipeline’s build step pushed for the pull request’s head commit, by digest. Nothing else is needed: the pull request run that the push already starts is what produces it. Ankra never deploys a tag that could still point at an older commit. While that run is still going, the preview waits and the comment says Building. When the run concludes, Ankra deploys straight away. If the run fails before it produces an image, the preview reports Failed with the reason, for example Pipeline run #53 failed to build 524ba32: .... The next push, or a later successful run for the same commit, deploys it. The pipeline needs its CI cluster and an approved definition before it runs at all - see Before your first run.

Applications built by GitHub Actions

The preview deploys an image from the application’s registry repository tagged with, in this order of preference:
  1. sha-<7> - the first seven characters of the pull request’s head commit,
  2. pr-<number> - the pull request number,
  3. the branch name, with every character other than letters, digits, ., _ and - replaced by -.
The generated build-and-publish.yml workflow builds and scans the image on a pull request but never pushes it, so it produces none of these tags for a pull request. An application on the generated workflow therefore reports Build unavailable on every pull request. Previews work in this lane only when a workflow of your own pushes one of the tags above for pull requests, or after the application moves to Ankra Pipelines.
Ankra prefers the head’s own sha-<7> tag because a pr-<number> or branch tag can still hold an earlier push’s image.

The status comment

One marker-tagged comment per pull request, updated in place - never a stream of new comments. Lifecycle:
  • On open: the preview deploys as soon as the pull request’s image exists.
  • On every push: the preview redeploys with the new head; the comment’s Commit and Updated cells refresh.
  • On close or merge: the namespace is torn down immediately and the comment flips to ⚪ Stopped.
  • On expiry: previews are time-limited (the organisation’s How long a preview lives at first, 24 hours by default) and removed automatically; pushing again deploys a fresh one.
The application’s Previews view lists every running preview, a pull request preview with its Pull request number linked to GitHub. Stop preview removes one before its time.

Configuration and data

Automatic previews start from the application’s preview defaults under Applications → your application → Settings → Deploys: Preview defaults (preview variables, Preview database, Preview login) and What a preview starts with (a stack profile, shared services, a migration command). Set what every preview starts with explains each one. If your app needs configuration to boot, set the defaults once and every pull request preview gets them. The defaults apply to new previews; a preview already running keeps what it was launched with.

Troubleshooting


  • Ship Your App - the routes from a repository to a running, redeploying application, and which builder feeds previews
  • Preview a branch - start a preview of any branch by hand, and set the preview defaults every preview starts from
  • Preview demos - launch a demo manually from the portal, CLI, or the deploy_pr_demo MCP tool
  • The preview URL - how the public hostname is resolved
  • Ankra Pipelines - the in-cluster CI whose pull request runs build preview images