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.
- Add a button to the header to link to the clean up environments page.
- Clean up environments button is hidden when a cleanup process is in progress.
- When a cleanup process is in progress display an informational alert
- Alert is dismissable but should reappear on page load
- Alert indicates the current progress of the job
- Action button allows a user to cancel the cleanup process
- Once the job has completed, the alert will not be shown on subsequent page loads
|Clean up in progress|
|No deployment clean up in progress|
|Inactive deployment clean up in progress|
Clean up environments page
- Default to No deployment
- Disable date input if No deployments option is selected
- Default date input to 30 days in the past
- Validate date input and disable
Clean upbutton if invalid
- Date must be a valid date
- Date must be in the past
|Inactive deployments option is selected|
|Date input disabled when other clean up options are selected|
|Date input error|
Make sure these are completed before closing the issue, with a link to the relevant commit.