Review apps strict lifecycle
Description
We would like to start using review apps to deploy multiple staging environments for GitLab.com. The issue we are foreseeing, and that we are already seeing in www-gitlab-com, is that currently, the only way a review app is cleaned is when we drop the branch on which the MR is based.
Sadly, in the previous example, we have been seeing that people do not care too much about dropping those branches. This could be because people just forgets to click "remove branch on merge", but that is still not good enough for us because one thing is deploying a static website that is a couple of megs, one quite different thing is building a full blown GitLab version with storage and database and leave it there working, forgotten.
Proposal
We need to have a way of defining a strict lifecycle for review apps. We can build the deploy mechanism, but we will need to enforce cleanup to avoid bleeding resources like crazy.
A simple way would be to have a way of manually triggering the deploy of the review app (so people can work with the MR and only click deploy when they are confident enough - this could be covered by the WIP though) but then having a defined lifecycle, for example, dropping the review app 2 hours after the deploy is finished.
This way we would enforce resource reaping, which is critical for a project as large as GitLab-CE
Another thing to think about is that we need to prevent people from using review apps from the outside without our permission, think of an abuser pushing multiple MRs to this project and consuming lots of resources, this could easily become an attack vector.