---
title: Environments and Promotion
description: How Forge pipelines implement SAIF's environment and promotion management standard, including environments, approvals, approval expiration, and branch strategy.
---

# Environments and Promotion

The [IT Standard | Environment and promotion management (KB0014424)](https://saif.service-now.com/kb_view.do?sysparm_article=KB0014424) governs how changes move between environments at SAIF. This page explains how Forge pipelines implement that standard: which environments a change passes through, who approves each step, how long an approval stays open, and how branches feed promotion.

## 📜 Standard and Forge Implementation

| Standard requirement                                                          | How Forge implements it                                                                                                                                                                                                                     |
| ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Cloud test, QA, UAT, and production map one-to-one to the on-prem environments | Each deployed environment has one Azure DevOps environment and one on-prem equivalent. See [Environments](#environments).                                                                                                                   |
| Changes move from local development through managed cloud environments to production | A single pipeline run promotes the same build through Test, QA, UAT, and Production in order. See [Promotion Flow](#promotion-flow).                                                                                                    |
| Peer review happens through a pull request                                    | Changes reach `main` through pull requests, and PR validation pipelines run before merge. QA, UAT, and Production accept only runs from `main` or `releases/*` branches that have branch protection, so unreviewed code stops at Test. See [Branch Strategy](#branch-strategy). |
| No change stays unpromoted for more than 30 days unless agreed                | Each of the three approvals expires after 7 days, so a single pass through the gates waits at most 21 days for approvals, under the 30-day limit. An expired approval ends a stale run, and the new run that promotes the change picks up current pipeline templates. See [Approval Expiration](#approval-expiration). |
| Production changes need change advisory board approval                       | The `azure_prod` approval check gates the deployment itself, and the person who queued the run cannot approve it. It does not replace change advisory board approval, which follows the standard's change process. |
| A hotfix environment deploys to production, then the fix flows back through the managed environments | Forge has no hotfix Azure DevOps environment today. A fix lands on `main` and promotes through every environment, or goes onto a release branch by backport. See [Release branches](#release-branches-releasesmajorminor). |

The standard also covers unmanaged, demo, and other environments. Forge pipelines don't deploy to those, so this page doesn't cover them.

## 📋 Environments

Local development runs on a developer's machine through Aspire and has no Azure DevOps environment or approval. Every deployed environment below maps to an Azure DevOps environment that holds its approval checks.

| Azure DevOps environment | Purpose                                                                     | Approver group (expected role)                                                  | Requester can approve | Allowed branches         | Approval expires after | On-prem equivalent |
| ------------------------ | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | --------------------- | ------------------------ | ---------------------- | ------------------ |
| `azure_test`             | Feature is finished and deploys to a full environment                       | None, deploys continuously                                                      | N/A                   | Any                      | N/A                    | Test-integration   |
| `azure_qa`               | Feature is ready for developers and testers to validate                     | `Azure Environment Approvers - QA` (Peer or QA)                                 | Yes                   | `main`, `releases/*`     | 7 days                 | QA                 |
| `azure_uat`              | Business users and business analysts confirm the feature meets requirements | `Azure Environment Approvers - UAT` (Product Owner or Manager)                  | Yes                   | `main`, `releases/*`     | 7 days                 | UAT                |
| `azure_prod`             | Live workloads                                                              | `[SAIFCorporation]\Azure Environment Approvers - Prod` (Senior Peer or Manager) | No                    | `main`, `releases/*`     | 7 days                 | Production         |

The platform team defines these environments and their checks centrally, so every Azure DevOps project that has them gets the same settings. The QA and UAT approver groups are project-level groups. The Prod approver group is an organization-level group. The branch control check also requires branch protection on the deploying branch.

The shared pipeline templates select the Azure DevOps environment through the `AzureDevOpsEnvironment` variable in `v2/environments/saif/*.yml`. See [Pipelines](pipelines.md#shared-variable-templates) for how deploy pipelines load those variables.

### Production staging slot (optional)

Production can deploy through a staging slot and swap into the live slot. This step runs inside the `azure_prod` stage, after the production approval, and is not a separate Azure DevOps environment. The shared templates allow it only in Production, and a pipeline opts in with `blueGreen.enabled: true`. Without it, Production deploys directly like the other environments. See [Blue-Green Deployments](../build/deploy/blue-green-deployments.md) for the pre-swap and post-swap validation gates and rollback.

## 🔄 Promotion Flow

```mermaid
sequenceDiagram
    Local ->> Test: Feature is complete and merged to main
    Test ->> Local: Bug found in the full environment
    Test ->> QA: Integration passed, ready for QA testing
    QA ->> Local: Bug found in QA testing
    QA ->> UAT: QA testing passed, ready for business users and BAs
    UAT ->> Local: Bug found by business users
    UAT ->> Production: UAT passed, approved for production
    Note over Production: Optional staging slot: deploy, validate, then swap
    Production ->> Local: Issue found in production, fix lands on main
```

## ⏳ Approval Expiration

In every project that has them, the approval checks on QA, UAT, and Production expire after 7 days, and Test has no approval. When an approval expires, Azure DevOps skips the stage that was waiting for it. The [Environment and promotion management standard (KB0014424)](https://saif.service-now.com/kb_view.do?sysparm_article=KB0014424) says no change should stay unpromoted for more than 30 days. A run passes three approval gates, and each one waits at most 7 days, so a single pass that sits at every gate until the last moment spends up to 21 days waiting for approvals. That stays under the 30-day limit. Re-running a skipped stage or queuing a new run opens new approval windows, so the expiration bounds one pass rather than the age of a change, and teams still track how long a change stays unpromoted.

The expiration also keeps runs current with the platform. A run holds the pipeline-templates version from when it was queued. The expiration ends a stale run, and the new run we recommend below picks up the current templates. That lets the platform team roll out pipeline changes and platform updates in a timely way, without old runs lingering on earlier versions.

We recommend treating a run with an expired approval as finished and queuing a new run to promote the change, rather than re-running the skipped stage.

Re-running a skipped stage creates a fresh approval with a new 7-day window, so the expiration does not prevent it. The re-run still uses everything the run fixed when it was queued: the commit, the pipeline-templates version, and the parameters. If pipeline-templates or a Forge module changed in between, the re-run deploys with steps that are out of date for that change and can fail even though a new run would succeed. See [Terraform Init fails with 401 Unauthorized from tf.pulumi.com](../troubleshoot/terraform-init-tf-pulumi-com-401-unauthorized.md) for one case.

A new run starts at the first stage, so it goes back through Test, QA, and UAT before Production. Plan for that time when a release sits waiting for approval.

## 🌳 Branch Strategy

Branches decide what enters the promotion flow. Every deploy pipeline template triggers CI on `main`, so Forge promotion is trunk-based by default. The branch control check on QA, UAT, and Production enforces that: only runs from `main` or `releases/*` can deploy past Test. This section covers when to rely on the default versus cutting a release branch.

!!! note "This is a recommendation, not a mandate"
    The guidance below reflects how the platform team operates Forge's own releases and backports. Teams can adapt it to their own branching needs, but trunk-based deployment and treating `releases/*` as snapshots are what the platform team recommends as a starting point.

### Trunk-based deployment (preferred)

- Merge to `main` only after a change has been fully tested. `main` is the single source that promotes through Test, QA, UAT, and Production in order.
- Test a feature branch in an isolated Azure slot before merging, using [PR Slot Deployments](../build/deploy/pr-slot-deployments.md), instead of merging early just to get a build into a shared environment like QA.
- This keeps every environment fed from the same tested, reviewed history and avoids maintaining parallel long-lived branches.

### Release branches (`releases/{major}.{minor}`)

- Cut a release branch as a **point-in-time snapshot from `main`**, never as its own line of ongoing feature development. `main` stays the trunk; a release branch exists to stabilize or patch a version that has already moved past it.
- Never commit directly to a release branch. Land the change on `main` first, then bring it onto the release branch by cherry-pick or backport, so the branch never diverges from `main`'s history. The platform team uses the same model for Forge's own releases and patches.
- Protect `releases/*` with a branch-name-pattern policy (not a per-branch one), so every new release branch inherits it automatically:
    - Restrict merge types to **rebase and fast-forward only**, so commits backported from `main` resolve cleanly on top instead of producing merge commits that fight later backports.
    - Require the same reviewer approvals as `main`.

## 🔗 Related

- [Service ↔ Azure Resource Model](./service-azure-resource-model.md) - Each environment of a service runs in its own Azure subscription and maps to a specific Entra application registration and App Service. Covers the naming invariant, environment-to-subscription topology, and resource discovery.
- [Blue-Green Deployments](../build/deploy/blue-green-deployments.md) - The optional production staging slot, validation gates, and rollback
- [PR Slot Deployments](../build/deploy/pr-slot-deployments.md) - Test a branch in an isolated slot before merging
- [Pipelines](pipelines.md) - Pipeline triggers, variables, and shared templates
