Skip to content

Add ability to destroy/cleanup/deprovision runway services

Currently we have no task in CI that will destroy/cleanup/deprovision a service in Runway.

If you remove a service from the provisioner project, this will remove the deployment project etc, but will not actually do anything with the running service or any other resources created by terraform in the deployment project.

We should

  1. Add a manual on_stop job to all deployment project pipelines that will run terraform destroy. This means we have a way of running a destroy all resources in all environments created by Runway.
  2. Figure out how to automate running this destroy job when the provisioner deprovisions a project (before the provisioner does it's work).

Status

The target state of runway workload deprovisioning is for users to open an MR on runway provisioner, removing the entry from inventory.json. The provisioner pipeline should

  1. Diff against the latest inventory.json to identify workloads for de-provisioning
  2. Trigger a de-provisioning pipeline on the respective deployment projects
  3. Proceed with applying the terraform changes on the provisioner only after deployment projects have completed and their terraform states are cleared.

2 phases of work:

  1. Deprovisioning functionality on runwayctl: runwayctl!509 (merged)
  2. Provisioner to trigger and monitor deprovisioning: MR to be prepared

Separating the responsibilities allow runway users to perform de-provisioning on their own.

Closing summary

The fully-functioning destroy feature is available in runwayctl from v3.18.1.

There are 2 ways to trigger a deletion

  1. [power-user method] Setting DESTROY_RUNWAY_WORKLOAD CI variable on the service project
  2. [preferred route] Delete the Runway workload entry on https://gitlab.com/gitlab-com/gl-infra/platform/runway/provisioner/-/blob/main/inventory.json

An example of a destroy workflow is in

Edited by Sylvester Chin