Commit 80fc31b2 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 75f47306
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -214,8 +214,7 @@ Here are variables supported to configure review environments:
| :lock: `S3_REVIEW_SECRET_KEY` | S3 service Secret Key for `review` env  _(only define if different from default)_    | `$S3_SECRET_KEY` |
| `S3_REVIEW_BUCKET_NAME`  | Bucket name for `review` env      | `"${S3_BASE_BUCKET_NAME}-${CI_ENVIRONMENT_SLUG}"` (ex: `myproject-review-fix-bug-12`) |
| `S3_REVIEW_PREFIX`  |  S3 prefix to use for `review` env _(only define if different from default)_ | `S3_PREFIX` |

Note: By default, review `environment.url` will be built as `${S3_REVIEW_ENVIRONMENT_SCHEME}://${$CI_PROJECT_NAME}-${CI_ENVIRONMENT_SLUG}.${S3_REVIEW_ENVIRONMENT_DOMAIN}`
| `S3_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
@@ -122,6 +122,11 @@
          "name": "S3_REVIEW_PREFIX",
          "description": "S3 prefix to use for `review` env _(only define if different from default)_",
          "advanced": true
        },
        {
          "name": "S3_REVIEW_AUTOSTOP_DURATION",
          "description": "The amount of time before GitLab will automatically stop `review` environments",
          "default": "4 hours"
        }
      ]
    },
+2 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ variables:
  S3_BASE_BUCKET_NAME: "$CI_PROJECT_NAME"
  S3_SCRIPTS_DIR: "."
  S3_BASE_TEMPLATE_NAME: "s3"
  S3_REVIEW_ENVIRONMENT_SCHEME: "https"
  S3_REVIEW_AUTOSTOP_DURATION: "4 hours"
  S3_DEPLOY_ARGS: "sync --recursive --delete-removed --acl-public --no-mime-magic --guess-mime-type"
  S3_DEPLOY_FILES: "public/"
  S3_WEBSITE_ARGS: "ws-create --ws-index=index.html --ws-error=404.html"
@@ -533,6 +533,7 @@ s3-review:
  environment:
    name: review/$CI_COMMIT_REF_NAME
    on_stop: s3-cleanup-review
    auto_stop_in: "$S3_REVIEW_AUTOSTOP_DURATION"
  resource_group: review/$CI_COMMIT_REF_NAME
  rules:
    # exclude tags