Skip to content

Use variables to define deploy policy for staging and production environments

Note: This issue requires https://gitlab.com/gitlab-org/gitlab-ce/issues/37397.

Owners

BE: @mayra-cabrera

Description

The current behavior of Auto DevOps is to use Continuous Deployment, pushing to production automatically every time a new pipeline is run on master.

There are cases where people want to use a staging environment, and deploy to production manually.

This is actually possible, but requires a few manual steps:

  1. make Auto Devops an explicit .gitlab-ci.yml
  2. enable the staging job
  3. change the production job to be manual

We should make it driven by variables, so the only needed step will be:

  1. define a group/project variable to enable the staging flow

Proposal

Improve the Auto DevOps template in order to support staging for deployments.

Required changes to the staging job:

  1. always defined (no trailing . in the job name)
  2. enable only when $STAGING_ENABLED

Required changes to the production job:

  1. enable except when $STAGING_ENABLED

A new job production_manual must be created cloning the production job:

  1. enable only when $STAGING_ENABLED
  2. define when: manual

Merge Requests

Edited by Mayra Cabrera