Commit 9a253900 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/gcloud!43
parents 0e65f71f d03c9903
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -293,7 +293,7 @@ Here are variables supported to configure the production environment:
| :lock: `GCP_PROD_KEY_FILE`|[Service Account key file](https://cloud.google.com/bigquery/docs/authentication/service-account-file) to authenticate on `production` env  _(only define if different from default)_    | `$GCP_KEY_FILE` |
| `GCP_PROD_APP_NAME`       | Application name for `production` env  | `$GCP_BASE_APP_NAME` |
| `GCP_PROD_ENVIRONMENT_URL`| The production environment url _(only define for static environment URLs declaration and if different from default)_ | `$GCP_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) |
| `GCP_PROD_DEPLOY_STRATEGY`| Defines the deployment to production strategy. One of `manual` (i.e. _one-click_) or `auto`. | `manual` |
| `GCP_PROD_OIDC_PROVIDER` | Workload Identity Provider associated with GitLab to [authenticate with OpenID Connect](https://docs.gitlab.com/ee/ci/cloud_services/google_cloud/) on `production ` environment | none|
| `GCP_PROD_OIDC_ACCOUNT`  | Service Account to which impersonate with OpenID Connect authentication on `production ` environment | none  |

+5 −3
Original line number Diff line number Diff line
@@ -191,9 +191,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": "GCP_PROD_DEPLOY_STRATEGY",
          "description": "Defines the deployment to production strategy.",
          "type": "enum",
          "values": ["manual", "auto"],
          "default": "manual"
        },
        {
          "name": "GCP_PROD_KEY_FILE",
+4 −7
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@ variables:
  GCP_BASE_APP_NAME: "$CI_PROJECT_NAME"
  GCP_REVIEW_ENVIRONMENT_SCHEME: "https"

  # default: one-click deploy
  GCP_PROD_DEPLOY_STRATEGY: manual

  # default production ref name (pattern)
  PROD_REF: '/^(master|main)$/'
@@ -525,7 +527,6 @@ gcp-staging:
    # only on production branch(es), with $GCP_STAGING_PROJECT set
    - if: '$GCP_STAGING_PROJECT && $CI_COMMIT_REF_NAME =~ $PROD_REF'

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