Commit e26561b7 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 41f2e12f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -240,6 +240,7 @@ Here are variables supported to configure review environments:
| `AWS_REVIEW_ENABLED`     | AWS project ID for `review` env | _none_ (disabled) |
| `AWS_REVIEW_APP_NAME`    | Application name for `review` env      | `"${AWS_BASE_APP_NAME}-${CI_ENVIRONMENT_SLUG}"` (ex: `myproject-review-fix-bug-12`) |
| `AWS_REVIEW_ENVIRONMENT_URL`| The review environments url _(only define for static environment URLs declaration and if different from default)_ | `$AWS_ENVIRONMENT_URL` |
| `AWS_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
@@ -39,6 +39,11 @@
          "description": "The application name for review env (only define if different from global)",
          "advanced": true
        },
        {
          "name": "AWS_REVIEW_AUTOSTOP_DURATION",
          "description": "The amount of time before GitLab will automatically stop `review` environments",
          "default": "4 hours"
        },
        {
          "name": "AWS_REVIEW_ENVIRONMENT_URL",
          "type": "url",
+5 −0
Original line number Diff line number Diff line
@@ -45,8 +45,11 @@ variables:
  AWS_SCRIPTS_DIR: "."

  AWS_BASE_APP_NAME: "$CI_PROJECT_NAME"
  # deprecated, backward compatibility
  AWS_REVIEW_ENVIRONMENT_SCHEME: "https"

  AWS_REVIEW_AUTOSTOP_DURATION: "4 hours"

  # default: one-click deploy
  AWS_PROD_DEPLOY_STRATEGY: manual

@@ -429,11 +432,13 @@ aws-review:
    ENV_TYPE: review
    ENV_APP_NAME: "$AWS_REVIEW_APP_NAME"
    ENV_URL: "${AWS_REVIEW_ENVIRONMENT_URL}"
    # deprecated, backward compatibility
    ENV_URL_LEGACY: "${AWS_REVIEW_ENVIRONMENT_SCHEME}://${CI_PROJECT_NAME}-${CI_ENVIRONMENT_SLUG}.${AWS_REVIEW_ENVIRONMENT_DOMAIN}"
    ENV_OIDC_ROLE_ARN: "$AWS_REVIEW_OIDC_ROLE_ARN"
  environment:
    name: review/$CI_COMMIT_REF_NAME
    on_stop: aws-cleanup-review
    auto_stop_in: "$AWS_REVIEW_AUTOSTOP_DURATION"
  resource_group: review/$CI_COMMIT_REF_NAME
  rules:
    # exclude tags