Merge Request Preview Environments

Applies to: FlexLab

Overview

Merge Request Preview Environments (often shortened to MRE or “preview envs”) spin up a temporary copy of your site for a single GitLab merge request (MR). Stakeholders can click a preview link to review changes before they merge to production.

Key concepts

  • Merge request — a proposal to combine one branch into another, with discussion and code review in GitLab.
  • Preview URL — a short-lived hostname FlexSite assigns to the MR build.
  • Teardown — when the MR closes or merges, FlexSite removes the preview to save credits.

Prerequisites

  • FlexLab project with MRE enabled in the platform template or org settings.
  • A .gitlab-ci.yml job that creates preview environments (included in standard FlexSite templates).

Steps

  1. Push a feature branch and open a merge request in GitLab.
  2. Wait for the pipeline’s preview job to finish.
  3. Find the preview link in the MR comment, GitLab Environments tab, or a temporary card on FlexSite Environments.
  4. Share the URL with reviewers; test acceptance criteria on real infrastructure.
  5. Merge or close the MR — the preview environment is destroyed automatically.

Credits and cleanup

Preview environments spend credits while running. Close stale merge requests you no longer need.

MRE is FlexLab onlyCodeless and Atom do not use Git merge requests.