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:
- make Auto Devops an explicit
.gitlab-ci.yml - enable the
stagingjob - change the
productionjob to be manual
We should make it driven by variables, so the only needed step will be:
- 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:
- always defined (no trailing
.in the job name) - enable only when
$STAGING_ENABLED
Required changes to the production job:
- enable except when
$STAGING_ENABLED
A new job production_manual must be created cloning the production job:
- enable only when
$STAGING_ENABLED - define
when: manual
Merge Requests
- GitLab Ci Yml: gitlab-ci-yml!160 (merged)
- Documentation for CE: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18675
- Documentation for EE (Port): https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/5536
Edited by Mayra Cabrera