Skip to content
Snippets Groups Projects
Commit 383ed88a authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

feat(deploy): redesign deployment strategy

BREAKING CHANGE: $AUTODEPLOY_TO_PROD no longer supported (replaced by $K8S_PROD_DEPLOY_STRATEGY - see doc)
parent 2b1c2b5b
No related branches found
No related tags found
No related merge requests found
...@@ -432,7 +432,7 @@ Here are variables supported to configure the production environment: ...@@ -432,7 +432,7 @@ Here are variables supported to configure the production environment:
| `K8S_PROD_URL` | Kubernetes API url for `production` env _(only define if using exploded kubeconfig parameters and if different from default)_| `$K8S_URL` | | `K8S_PROD_URL` | Kubernetes API url for `production` env _(only define if using exploded kubeconfig parameters and if different from default)_| `$K8S_URL` |
| `K8S_PROD_CA_CERT` | the Kubernetes server certificate authority for `production` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_CA_CERT` | | `K8S_PROD_CA_CERT` | the Kubernetes server certificate authority for `production` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_CA_CERT` |
| :lock: `K8S_PROD_TOKEN` | service account token for `production` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_TOKEN` | | :lock: `K8S_PROD_TOKEN` | service account token for `production` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_TOKEN` |
| `AUTODEPLOY_TO_PROD` | Set this variable to auto-deploy to production. If not set deployment to production will be `manual` (default behaviour). | _none_ (disabled) | | `K8S_PROD_DEPLOY_STRATEGY`| Defines the deployment to production strategy. One of `manual` (i.e. _one-click_) or `auto`. | `manual` |
### kube-score job ### kube-score job
......
...@@ -231,9 +231,11 @@ ...@@ -231,9 +231,11 @@
"advanced": true "advanced": true
}, },
{ {
"name": "AUTODEPLOY_TO_PROD", "name": "K8S_PROD_DEPLOY_STRATEGY",
"type": "boolean", "description": "Defines the deployment to production strategy.",
"description": "Set this variable to auto-deploy to production. If not set deployment to production will be manual (default behaviour)." "type": "enum",
"values": ["manual", "auto"],
"default": "manual"
}, },
{ {
"name": "K8S_PROD_KUBE_CONFIG", "name": "K8S_PROD_KUBE_CONFIG",
......
...@@ -51,6 +51,9 @@ variables: ...@@ -51,6 +51,9 @@ variables:
K8S_SCRIPTS_DIR: "." K8S_SCRIPTS_DIR: "."
K8S_REVIEW_ENVIRONMENT_SCHEME: "https" K8S_REVIEW_ENVIRONMENT_SCHEME: "https"
# default: one-click deploy
K8S_PROD_DEPLOY_STRATEGY: manual
#K8S_KUSTOMIZE_ARGS: "--enable-helm" #K8S_KUSTOMIZE_ARGS: "--enable-helm"
# default production ref name (pattern) # default production ref name (pattern)
...@@ -811,7 +814,6 @@ k8s-staging: ...@@ -811,7 +814,6 @@ k8s-staging:
# only on production branch(es), with $K8S_STAGING_SPACE set # only on production branch(es), with $K8S_STAGING_SPACE set
- if: '$K8S_STAGING_SPACE && $CI_COMMIT_REF_NAME =~ $PROD_REF' - if: '$K8S_STAGING_SPACE && $CI_COMMIT_REF_NAME =~ $PROD_REF'
# deploy to production if on branch master and variable K8S_PROD_SPACE defined and AUTODEPLOY_TO_PROD is set
k8s-production: k8s-production:
extends: .k8s-deploy extends: .k8s-deploy
stage: production stage: production
...@@ -835,10 +837,6 @@ k8s-production: ...@@ -835,10 +837,6 @@ k8s-production:
# exclude if $K8S_PROD_SPACE not set # exclude if $K8S_PROD_SPACE not set
- if: '$K8S_PROD_SPACE == null || $K8S_PROD_SPACE == ""' - if: '$K8S_PROD_SPACE == null || $K8S_PROD_SPACE == ""'
when: never when: never
# if $AUTODEPLOY_TO_PROD: auto - if: '$K8S_PROD_DEPLOY_STRATEGY == "manual"'
- if: '$AUTODEPLOY_TO_PROD == "true"'
# else if PUBLISH_ON_PROD enabled: auto (because the publish job was blocking)
- if: '$PUBLISH_ON_PROD == "true"'
# else: manual, blocking
- if: $K8S_PROD_SPACE # useless test, just to prevent GitLab warning
when: manual when: manual
- if: '$K8S_PROD_DEPLOY_STRATEGY == "auto"'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment