Remove environment git refs after an environment removed

Description

In GitLab's Environment feature, the system creates git refs when deployment happens. The ref is formatted as "refs/environments/#{slug}/deployments/#{deployment_iid}" (e.g. "refs/environments/production/deployments/1").

However, the system doesn't remove the ref when users removed an environment, which should be as no longer necessary. Thus the number of refs grow linearly and eventually could affect git clone's performance as described in omnibus-gitlab!2932 (comment 127592061).

As described in https://gitlab.com/gitlab-org/gitlab-ce/issues/33388, it seems we should cleanup keep-around as well.

Proposal

Remove environment and keep-around refs when an environment is removed

Edited by Shinya Maeda