Add rake task to clean up review apps

Problem

Sometimes review app environments left as active even though an associated merge request is merged or closed. This situation happens when:

  • on_stop job is not defined in a pipeline
  • on_stop job was triggered but failed
  • User didn't remove the source branch of the merge request, so that on_stop was not triggered (This happens ~%11.10)
  • on_stop job is not triggered because of a bug

We should have a way to clean up these environments.

Proposal

Add rake task to trigger on_stop jobs, which fall under the following conditions:

  • The associated merge request is merged or closed
  • The review app's environment is still active.

Here is the administration command (rake task).

rake gitlab:environments:stop_review_environments

Or, we can consider adding a button at the project level.

Edited May 20, 2019 by Shinya Maeda
Assignee Loading
Time tracking Loading