Environment variables
The PULLPREVIEW_* values PullPreview injects into each deployment — available to pre_script, Compose interpolation, and Helm placeholders.
On every deployment, PullPreview writes a set of PULLPREVIEW_* variables to /etc/pullpreview/env on the preview instance and uses them throughout the deployment. You can read these values from your pre_script, interpolate them into Compose service definitions, and reference them in Helm inputs.
Available variables
| Variable | Description |
|---|---|
PULLPREVIEW_PUBLIC_DNS | Generated public DNS name for the preview. |
PULLPREVIEW_PUBLIC_IP | Public IP address of the preview instance. |
PULLPREVIEW_URL | Full preview URL, including scheme and port. |
PULLPREVIEW_FIRST_RUN | true on the first deployment to an instance, otherwise false. |
PULLPREVIEW_DEPLOYMENT_TARGET | The deployment engine: compose or helm. See deployment targets. |
PULLPREVIEW_NAMESPACE | Kubernetes namespace for Helm previews. |
PULLPREVIEW_RELEASE_NAME | Helm release name for Helm previews (app). |
COMPOSE_FILE | Colon-separated Compose file list for Compose previews. Empty for Helm previews. |
Where they are available
These variables are exposed in three places during a deployment:
pre_script— every variable above is set in the environment when your pre_script runs, so you can branch on the deployment target, seed data on first run, or print the preview URL.- Compose environment interpolation — Docker Compose substitutes
${PULLPREVIEW_*}references in yourdocker-compose.ymlfrom the same environment. - Helm placeholder expansion — PullPreview expands placeholder tokens in the
chart_set,chart_values, andproxy_tlsinputs before applying the chart.
Placeholders vs. runtime variables
Helm inputs use a separate set of placeholder tokens that PullPreview expands into the input values before the deployment runs. These are not environment variables — they are template tokens you write in your workflow inputs:
| Placeholder | Runtime variable equivalent |
|---|---|
{{ pullpreview_url }} | PULLPREVIEW_URL |
{{ pullpreview_public_dns }} | PULLPREVIEW_PUBLIC_DNS |
{{ pullpreview_public_ip }} | PULLPREVIEW_PUBLIC_IP |
{{ release_name }} | PULLPREVIEW_RELEASE_NAME |
{{ namespace }} | PULLPREVIEW_NAMESPACE |
The distinction matters: placeholders are substituted into the input values you pass to the action, while the PULLPREVIEW_* environment variables are available inside the running deployment and your pre_script. See HTTPS and domains for an example of using {{ pullpreview_url }} in proxy_tls.
Compose interpolation example
Reference any variable in a Compose service environment to pass the live preview URL into your app:
services: web: image: myapp environment: APP_URL: ${PULLPREVIEW_URL}Docker Compose resolves ${PULLPREVIEW_URL} from /etc/pullpreview/env at deploy time, so your application always receives the correct scheme, host, and port for the preview.
Seeding on the first run
PULLPREVIEW_FIRST_RUN is the key to running one-time setup. It is true only on the first deployment to an instance, so you can guard expensive operations like database seeding behind it:
if [ "$PULLPREVIEW_FIRST_RUN" = "true" ]; then ./bin/seedfiSee seeding data for the full pattern.