Commit fc338243 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

Merge branch 'feat/deployment-strategy' into 'master'

feat(deploy): redesign deployment strategy

See merge request to-be-continuous/cloud-foundry!49
parents 2abae01c 1c9ecf85
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -184,7 +184,7 @@ Here are variables supported to configure the production environment:
| `CF_PROD_APP_NAME`    | Application name for `production` env  | `$CF_BASE_APP_NAME` |
| `CF_PROD_DOMAIN`      | CF domain for `production` env         | `$CF_DEFAULT_DOMAIN` |
| `CF_PROD_HOST_NAME`   | application host name for `production` env| `$CF_BASE_APP_NAME` |
| `AUTODEPLOY_TO_PROD`     | Determines the production deployment policy. When set, deployment to production is automatic (_continuous deployment_). When not set (default), deployment to production is manual (_continuous delivery_). | _none_ (_continuous delivery_) |
| `CF_PROD_DEPLOY_STRATEGY`| Defines the deployment to production strategy. One of `manual` (i.e. _one-click_) or `auto`. | `manual` |
| `CF_PROD_ZERODOWNTIME`| Enables zero-downtime deployment on `production` env | `true` |
| `CF_PROD_ENVIRONMENT_URL`      | The production environment url **including scheme** (ex: `https://my-application.public.domain.com`) Do not use variable inside variable definition as it will result in a two level cascade variable and gitlab does not allow that. | _none_ |
| `CF_PROD_RETIRED_APP_SUFFIX` | If set, the app old version is not deleted/overriden but renamed with this suffix | _none_ |
@@ -406,7 +406,7 @@ variables:
  # CF_DEFAULT_DOMAIN not defined: use CF default domain by default
  CF_PROD_DOMAIN: "acme.com" # on prod: use my own internet domain
  CF_PROD_ENVIRONMENT_URL: "https://frontend.myproject.acme.com" # internet route
  AUTODEPLOY_TO_PROD: "true"
  CF_PROD_DEPLOY_STRATEGY: "auto"

# Pipeline steps
stages:
+5 −3
Original line number Diff line number Diff line
@@ -239,9 +239,11 @@
          "mandatory": 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": "CF_PROD_DEPLOY_STRATEGY",
          "description": "Defines the deployment to production strategy.",
          "type": "enum",
          "values": ["manual", "auto"],
          "default": "manual"
        },
        {
          "name": "CF_PROD_ZERODOWNTIME",
+6 −7
Original line number Diff line number Diff line
@@ -57,6 +57,10 @@ variables:
  CF_SCRIPTS_DIR: "."
  CF_REVIEW_ENVIRONMENT_SCHEME: "https"
  CF_PROD_ZERODOWNTIME: "true"

  # default: one-click deploy
  CF_PROD_DEPLOY_STRATEGY: manual

  # default production ref name (pattern)
  PROD_REF: '/^(master|main)$/'
  # default integration ref name (pattern)
@@ -928,7 +932,6 @@ cf-staging:
    # only if $CF_STAGING_SPACE set
    - if: '$CF_STAGING_SPACE'

# Deploy to production if on branch master and variable CF_PROD_SPACE defined and AUTODEPLOY_TO_PROD is set
cf-production:
  extends: .cf-deploy
  stage: production
@@ -956,10 +959,6 @@ cf-production:
    # exclude if $CF_PROD_SPACE not set
    - if: '$CF_PROD_SPACE == null || $CF_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: $CF_PROD_SPACE # useless test, just to prevent GitLab warning
    - if: '$CF_PROD_DEPLOY_STRATEGY == "manual"'
      when: manual
    - if: '$CF_PROD_DEPLOY_STRATEGY == "auto"'