Skip to content

Provide a mechanism to clean up stale environments

Description

So, this is coming from a problem we're currently facing.

We have the review-docs manual job which created review-docs environments. As you can see, we currently have almost 500 environments, 95% of which do not have a deployment.

The environments are created when the job is in created state, which means even if it's a manual job.

Proposal

Provide a button that will stop and delete all environments that are currently with no deployment, or are older than a specified date. That action would be similar to the "Delete merged branches" https://docs.gitlab.com/ee/user/project/repository/branches/index.html#delete-merged-branches.

A separate API update to make this possible from a script is also being considered at https://gitlab.com/gitlab-org/gitlab-ee/issues/5582.

Use cases

For people struggling to clean up stale environments.

UX Proposal

Here are some preliminary mock-ups.

Environments page

Add a button to the header to link to the clean up environments page.

Enviornments

Clean up enviornments page

Clean_Up

Scenario Mockup
Old environments unchecked Clean_Up_Disable
Date input error Clean_Up_Error

Specifications

  • Default to both No deployment environments and Old environments checked
  • Disable date input if Old environments is unchecked
  • Default date input to 30 days in the past
  • Validate date input and disable Clean up button if invalid
  • Environments with no deployments will be used instead of No deployment environments

Feature checklist

Make sure these are completed before closing the issue, with a link to the relevant commit.

Edited by Mike Nichols