Provide a mechanism to clean up stale environments
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.
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.
For people struggling to clean up stale environments.
Here are some preliminary mock-ups.
Add a button to the header to link to the clean up environments page.
Clean up enviornments page
|Old environments unchecked|
|Date input error|
- 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 upbutton if invalid
- Environments with no deployments will be used instead of No deployment environments
Make sure these are completed before closing the issue, with a link to the relevant commit.
Added to features.yml