Switch between deploying to staging or production
Description
Auto DevOps has jobs defined for automatically deploying to staging and production, but only one is active at a time and a user needs to edit the .gitlab-ci.yml
to configure deployments to staging. We should use variables to control this flow instead.
Proposal
- Listen for
AUTO_DEVOPS_STRATEGY
- Make staging job
only: expressions: $KUBECONFIG && &KUBE_DOMAIN && $AUTO_DEVOPS_STRATEGY=='staging'
- Make a new job for production with
when: manual
andonly: expressions: $KUBECONFIG && &KUBE_DOMAIN && $AUTO_DEVOPS_STRATEGY=='staging'
- Make existing production job
only: expressions: $KUBECONFIG && &KUBE_DOMAIN && $AUTO_DEVOPS_STRATEGY=='production'
- With https://gitlab.com/gitlab-org/gitlab-ce/issues/38547, add UI to set deployment strategy
Alternatively, use AUTO_DEVOPS_CONTINUOUS_DEPLOYMENT
true/false to indicate production/staging respectively. This may be necessary as the next iteration of expressions may only support true/false.
Links / references
- Depends on https://gitlab.com/gitlab-org/gitlab-ce/issues/37397
- Part of https://gitlab.com/gitlab-org/gitlab-ce/issues/37290
Documentation blurb
Overview
What is it? Why should someone use this feature? What is the underlying (business) problem? How do you use this feature?
Use cases
Who is this for? Provide one or more use cases.
Feature checklist
Make sure these are completed before closing the issue, with a link to the relevant commit.
- Feature assurance
- Documentation
- Added to features.yml