diff --git a/README.md b/README.md index a62af6efa7219a94d5364577f41a44b28226aa5d..f8a468619c3bb6fbd197b97301a2d1f4a0524283 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/kicker.json b/kicker.json index 10ad824c352e8accde3151b52010c85e3bea09a7..7b46d1033c820918a6b5f3ea7cb2b6b1540402b9 100644 --- a/kicker.json +++ b/kicker.json @@ -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", diff --git a/templates/gitlab-ci-gcloud.yml b/templates/gitlab-ci-gcloud.yml index be380ab8bf1fc131a8646a6f81a257d60f439db8..930aa8f1fa01f2643ae02df1e7a85ef6cd49bd71 100644 --- a/templates/gitlab-ci-gcloud.yml +++ b/templates/gitlab-ci-gcloud.yml @@ -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"'