Commit f504e76e 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/aws!39
parents ac763ea8 2b95346d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -288,7 +288,7 @@ Here are variables supported to configure the production environment:
| `AWS_PROD_OIDC_ROLE_ARN`| IAM Role ARN associated with GitLab to [authenticate using OpenID Connect](https://docs.gitlab.com/ee/ci/cloud_services/aws/) on `production` env _(only define if different from global)_ | _none_ (disabled) |
| `AWS_PROD_APP_NAME`       | Application name for `production` env  | `$AWS_BASE_APP_NAME` |
| `AWS_PROD_ENVIRONMENT_URL`| The production environment url _(only define for static environment URLs declaration and if different from default)_ | `$AWS_ENVIRONMENT_URL` |
| `AUTODEPLOY_TO_PROD`      | Set this variable to auto-deploy to production. If not set deployment to production will be `manual` (default behaviour). | _none_ (disabled) |
| `AWS_PROD_DEPLOY_STRATEGY`| Defines the deployment to production strategy. One of `manual` (i.e. _one-click_) or `auto`. | `manual` |

## Examples

+5 −3
Original line number Diff line number Diff line
@@ -128,9 +128,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": "AWS_PROD_DEPLOY_STRATEGY",
          "description": "Defines the deployment to production strategy.",
          "type": "enum",
          "values": ["manual", "auto"],
          "default": "manual"
        }
      ]
    }
+6 −8
Original line number Diff line number Diff line
@@ -33,6 +33,9 @@ variables:
  AWS_BASE_APP_NAME: "$CI_PROJECT_NAME"
  AWS_REVIEW_ENVIRONMENT_SCHEME: "https"

  # default: one-click deploy
  AWS_PROD_DEPLOY_STRATEGY: manual

  # default production ref name (pattern)
  PROD_REF: '/^(master|main)$/'
  # default integration ref name (pattern)
@@ -478,7 +481,6 @@ aws-staging:
    # only on production branch(es), with $AWS_STAGING_ENABLED set
    - if: '$AWS_STAGING_ENABLED == "true" && $CI_COMMIT_REF_NAME =~ $PROD_REF'

# Deploy to production if on branch master and variable AWS_PROD_ENABLED defined and AUTODEPLOY_TO_PROD is set
aws-production:
  extends: .aws-deploy
  stage: production
@@ -498,10 +500,6 @@ aws-production:
    # exclude if $AWS_PROD_ENABLED not set
    - if: '$AWS_PROD_ENABLED != "true"'
      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: $AWS_PROD_ENABLED == "true" # useless test, just to prevent GitLab warning
    - if: '$AWS_PROD_DEPLOY_STRATEGY == "manual"'
      when: manual
    - if: '$AWS_PROD_DEPLOY_STRATEGY == "auto"'