Commit 08d32f5f 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 55106ecf
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -384,8 +384,7 @@ Here are variables supported to configure review environments:
| :lock: `OS_REVIEW_TOKEN` | OpenShift API [token](#supported-authentication-methods) for `review` env  _(only define if different from default)_    | `$OS_TOKEN` |
| `OS_REVIEW_APP_NAME`     | Application name for `review` env      | `"${OS_BASE_APP_NAME}-${CI_ENVIRONMENT_SLUG}"` (ex: `myproject-review-fix-bug-12`) |
| `OS_REVIEW_ENVIRONMENT_URL`| The review environments url _(only define for static environment URLs declaration and if different from default)_ | `$OS_ENVIRONMENT_URL` |

Note: By default, review `environment.url` will be built as `${OS_REVIEW_ENVIRONMENT_SCHEME}://${$CI_PROJECT_NAME}-${CI_ENVIRONMENT_SLUG}.${OS_REVIEW_ENVIRONMENT_DOMAIN}`
| `OS_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
@@ -67,6 +67,11 @@
          "description": "The application name for review env (only define if different from global)",
          "advanced": true
        },
        {
          "name": "OS_REVIEW_AUTOSTOP_DURATION",
          "description": "The amount of time before GitLab will automatically stop `review` environments",
          "default": "4 hours"
        },
        {
          "name": "OS_REVIEW_ENVIRONMENT_URL",
          "type": "url",
+4 −0
Original line number Diff line number Diff line
@@ -57,7 +57,9 @@ variables:
  OS_BASE_APP_NAME: "$CI_PROJECT_NAME"
  OS_SCRIPTS_DIR: "."
  OS_BASE_TEMPLATE_NAME: "openshift"
  # deprecated, backward compatibility
  OS_REVIEW_ENVIRONMENT_SCHEME: "https"
  OS_REVIEW_AUTOSTOP_DURATION: "4 hours"
  OS_CLEANUP_OBJECT_TYPES: "all,pvc,configmap,secret"

  # default: one-click deploy
@@ -684,6 +686,7 @@ os-review:
    ENV_TYPE: review
    ENV_APP_NAME: "$OS_REVIEW_APP_NAME"
    ENV_URL: "${OS_REVIEW_ENVIRONMENT_URL}"
    # deprecated, backward compatibility
    ENV_URL_LEGACY: "${OS_REVIEW_ENVIRONMENT_SCHEME}://${CI_PROJECT_NAME}-${CI_ENVIRONMENT_SLUG}.${OS_REVIEW_ENVIRONMENT_DOMAIN}"
    ENV_API_URL: "$OS_REVIEW_URL"
    ENV_TOKEN: "$OS_REVIEW_TOKEN"
@@ -691,6 +694,7 @@ os-review:
  environment:
    name: review/$CI_COMMIT_REF_NAME
    on_stop: os-cleanup-review
    auto_stop_in: "$OS_REVIEW_AUTOSTOP_DURATION"
  resource_group: review/$CI_COMMIT_REF_NAME
  rules:
    # exclude tags