Commit 13f6e081 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

feat: support environment auto-stop

parent 38dd0a69
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -334,6 +334,7 @@ Here are variables supported to configure review environments:
| `{{cookiecutter.template_PREFIX}}_REVIEW_API_URL`     | API url for `review` env _(only define if different from default)_ | `${{cookiecutter.template_PREFIX}}_API_URL` |
| `{{cookiecutter.template_PREFIX}}_REVIEW_API_TOKEN`   | API token for `review` env _(only define if different from default)_ | `${{cookiecutter.template_PREFIX}}_API_TOKEN` |
| `{{cookiecutter.template_PREFIX}}_REVIEW_ENVIRONMENT_URL`| The review environments url _(only define for static environment URLs declaration and if different from default)_ | `${{cookiecutter.template_PREFIX}}_ENVIRONMENT_URL` |
| `{{cookiecutter.template_PREFIX}}_REVIEW_AUTOSTOP_DURATION`| The amount of time before GitLab will automatically stop `review` environments | `4 hours` |

### Integration environment configuration

+5 −0
Original line number Diff line number Diff line
@@ -136,6 +136,11 @@
          "description": "The application name for `review` env (only define if different from global)",
          "advanced": true
        },
        {
          "name": "{{cookiecutter.template_PREFIX}}_REVIEW_AUTOSTOP_DURATION",
          "description": "The amount of time before GitLab will automatically stop `review` environments",
          "default": "4 hours"
        },
        {
          "name": "{{cookiecutter.template_PREFIX}}_REVIEW_ENVIRONMENT_URL",
          "type": "url",
+2 −2
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ variables:
  {{ cookiecutter.template_PREFIX }}_DEPCHECK_IMAGE: "registry.hub.docker.com/{{ cookiecutter.project_slug }}-depcheck:latest"
{%- elif cookiecutter.template_type == 'deploy' %}
  {{ cookiecutter.template_PREFIX }}_BASE_APP_NAME: "$CI_PROJECT_NAME"
  {{ cookiecutter.template_PREFIX }}_REVIEW_AUTOSTOP_DURATION: "4 hours"

  # default: one-click deploy
  {{ cookiecutter.template_PREFIX }}_PROD_DEPLOY_STRATEGY: manual
@@ -641,9 +642,8 @@ stages:
    ENV_PROJECT: "${{ cookiecutter.template_PREFIX }}_REVIEW_PROJECT"
  environment:
    name: review/$CI_COMMIT_REF_NAME
    # TODO: reference cleanup job
    on_stop: {{ cookiecutter.template_prefix }}-cleanup-review
  # TODO: use resource group
    auto_stop_in: "${{ cookiecutter.template_PREFIX }}_REVIEW_AUTOSTOP_DURATION"
  resource_group: review/$CI_COMMIT_REF_NAME
  rules:
    # exclude tags