BlogCI/CD

GitLab review apps: a fresh environment per merge request

Spin up an ephemeral deploy for every merge request and tear it down on merge — review real changes, not screenshots.

Nov 12, 2025·10 min readIntermediate

A review app is a full, running deploy of a branch, created when a merge request opens and destroyed when it merges or closes. Reviewers click a link and use the actual change instead of imagining it from a diff. GitLab builds this from two pipeline jobs and a dynamic environment.

Deploy on merge request

.gitlab-ci.yml
review:
stage: deploy
script:
- helm upgrade --install mr-$CI_MERGE_REQUEST_IID ./chart \
--set host=$CI_COMMIT_REF_SLUG.review.acme.dev
environment:
name: review/$CI_COMMIT_REF_SLUG
url: https://$CI_COMMIT_REF_SLUG.review.acme.dev
on_stop: stop_review
rules:
- if: $CI_MERGE_REQUEST_IID

Tear it down automatically

.gitlab-ci.yml
stop_review:
stage: deploy
script:
- helm uninstall mr-$CI_MERGE_REQUEST_IID
environment:
name: review/$CI_COMMIT_REF_SLUG
action: stop
rules:
- if: $CI_MERGE_REQUEST_IID
when: manual
The lifecycle
1
MR opens
review job runs
2
Env created
link on the MR
3
Reviewers
use the real app
4
MR merges
stop_review cleans up
Cap the sprawl
Give review namespaces a resource quota and a TTL sweeper. Abandoned MRs otherwise leave environments running and billing.
Go deeper in a courseSecure CI/CD with GitLabEnvironments, protected deploys, scanning and gates.View course

Related posts