Skip to content
Snippets Groups Projects
Commit 14156ff1 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

feat!: support environment auto-stop

BREAKING CHANGE: now review environments will auto stop after 4 hours
by default. Configurable (see doc).
parent 693fa313
No related branches found
No related tags found
No related merge requests found
......@@ -226,6 +226,7 @@ Here are variables supported to configure review environments:
| :lock: `GCP_REVIEW_KEY_FILE`| [Service Account key file](https://cloud.google.com/bigquery/docs/authentication/service-account-file) to authenticate on `review` env _(only define if different from default)_ | `$GCP_KEY_FILE` |
| `GCP_REVIEW_APP_NAME` | Application name for `review` env | `"${GCP_BASE_APP_NAME}-${CI_ENVIRONMENT_SLUG}"` (ex: `myproject-review-fix-bug-12`) |
| `GCP_REVIEW_ENVIRONMENT_URL`| The review environments url _(only define for static environment URLs declaration and if different from default)_ | `$GCP_ENVIRONMENT_URL` |
| `GCP_REVIEW_AUTOSTOP_DURATION`| The amount of time before GitLab will automatically stop `review` environments | `4 hours` |
### Integration environment configuration
......
......@@ -59,6 +59,11 @@
"description": "The application name for review env (only define if different from global)",
"advanced": true
},
{
"name": "GCP_REVIEW_AUTOSTOP_DURATION",
"description": "The amount of time before GitLab will automatically stop `review` environments",
"default": "4 hours"
},
{
"name": "GCP_REVIEW_ENVIRONMENT_URL",
"type": "url",
......
......@@ -45,7 +45,9 @@ variables:
GCP_SCRIPTS_DIR: "."
GCP_BASE_APP_NAME: "$CI_PROJECT_NAME"
# deprecated, backward compatibility
GCP_REVIEW_ENVIRONMENT_SCHEME: "https"
GCP_REVIEW_AUTOSTOP_DURATION: "4 hours"
# default: one-click deploy
GCP_PROD_DEPLOY_STRATEGY: manual
......@@ -455,10 +457,12 @@ gcp-review:
ENV_OIDC_ACCOUNT: "$GCP_REVIEW_OIDC_ACCOUNT"
ENV_KEY_FILE: "$GCP_REVIEW_KEY_FILE"
ENV_URL: "${GCP_REVIEW_ENVIRONMENT_URL}"
# deprecated, backward compatibility
ENV_URL_LEGACY: "${GCP_REVIEW_ENVIRONMENT_SCHEME}://${CI_PROJECT_NAME}-${CI_ENVIRONMENT_SLUG}.${GCP_REVIEW_ENVIRONMENT_DOMAIN}"
environment:
name: review/$CI_COMMIT_REF_NAME
on_stop: gcp-cleanup-review
auto_stop_in: "$GCP_REVIEW_AUTOSTOP_DURATION"
resource_group: review/$CI_COMMIT_REF_NAME
rules:
# exclude tags
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment