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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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_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` |
| `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

+5 −3
Original line number Diff line number Diff line
@@ -231,9 +231,11 @@
          "advanced": true
        },
        {
          "name": "AUTODEPLOY_TO_PROD",
          "type": "boolean",
          "description": "Set this variable to auto-deploy to production. If not set deployment to production will be manual (default behaviour)."
          "name": "K8S_PROD_DEPLOY_STRATEGY",
          "description": "Defines the deployment to production strategy.",
          "type": "enum",
          "values": ["manual", "auto"],
          "default": "manual"
        },
        {
          "name": "K8S_PROD_KUBE_CONFIG",
+5 −7
Original line number Diff line number Diff line
@@ -51,6 +51,9 @@ variables:
  K8S_SCRIPTS_DIR: "."
  K8S_REVIEW_ENVIRONMENT_SCHEME: "https"

  # default: one-click deploy
  K8S_PROD_DEPLOY_STRATEGY: manual

  #K8S_KUSTOMIZE_ARGS: "--enable-helm"

  # default production ref name (pattern)
@@ -811,7 +814,6 @@ k8s-staging:
    # only on production branch(es), with $K8S_STAGING_SPACE set
    - 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:
  extends: .k8s-deploy
  stage: production
@@ -835,10 +837,6 @@ k8s-production:
    # exclude if $K8S_PROD_SPACE not set
    - if: '$K8S_PROD_SPACE == null || $K8S_PROD_SPACE == ""'
      when: never
    # if $AUTODEPLOY_TO_PROD: auto
    - 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
    - if: '$K8S_PROD_DEPLOY_STRATEGY == "manual"'
      when: manual
    - if: '$K8S_PROD_DEPLOY_STRATEGY == "auto"'