Infraista DocsDocs
Developer toolsPipelines

Environments and deployments

Protect production with approvals, allowed branches, wait timers and deploy windows, see every deployment, and roll an environment back to an earlier run.

An environment is where a pipeline deploys, such as staging or production. A job deploys to one when it names it:

- name: production
  environment: production
  if: branch == main
  steps: [...]

Environments are created the first time a job names them, with no rules. Add rules on the pipeline's Environments tab.

The Environments tab with production (protected, one approval needed) and stagingThe Environments tab with production (protected, one approval needed) and staging

Protection rules

Rules are checked when a job for the environment is ready to start. A job that isn't allowed fails, with the reason shown on the job; one that needs approval or must wait shows as waiting.

RuleWhat it does
Required approvalsHow many people must approve. 0 deploys straight away
ApproversWho may approve. Nobody ticked: anyone who can manage pipelines
Prevent self-approvalThe person who started the run can't approve it
Allowed branchesOnly runs from these branches deploy here (* and ** work). Pull request runs never deploy to an environment with allowed branches
Wait timerWait this many minutes (after approval, if any) before the job starts, so a deploy can still be cancelled
Deploy windowDeploys only start inside these hours; runs that are ready outside the window wait for it

An environment can also have a URL, shown on the environment and on runs that deploy there.

Approve a deployment

Approvers get a notification in the console (and on the pipeline's notification channels). Open the run and approve or reject the waiting job, with an optional comment. Once enough people approve, the job starts (after the wait timer). One rejection fails the job.

Pull requests from forks can't deploy to an environment that has any protection rule.

Deployments and rollbacks

The Deployments tab lists every deploy job, newest first, with its environment, commit and result.

The Deployments tab listing two successful deployments to productionThe Deployments tab listing two successful deployments to production

To roll an environment back, select an earlier deployment and confirm. Infraista starts a new run with that deployment's commit and pipeline file. Only that environment's jobs run again; every other job is reused as it ended in that run. Protection rules still apply.

On this page