Review Apps Environments for merge request branches are not stopped upon merge/reject
Summary
Our current setup follows the review app approach of GitLab. An environment is created for every branch that is part of a merge request, and is supposed to be stopped once the merge request has been accepted/closed. The latter does not work.
deployReviewApp:
# Use an image that provides helm and kubectl
image: dtzar/helm-kubectl:3.1.1
stage: reviewApp
before_script:
- prepareDeployment
script:
- deployReviewApp
environment:
name: mr-$CI_MERGE_REQUEST_IID
url: http://URL/mr-$CI_MERGE_REQUEST_IID
on_stop: deleteReviewApp
only:
- merge_requests
deleteReviewApp:
image: dtzar/helm-kubectl:3.1.1
stage: reviewApp
before_script:
- prepareDeletion
script:
- deleteReviewApp
when: manual
environment:
name: mr-$CI_MERGE_REQUEST_IID
action: stop
only:
- merge_requests
I am pretty sure this worked about two months ago, where I tested it manually (by creating and closing merge requests).
Steps to reproduce
Use the provided snippet above. There is no need to properly set up an application in any way.
What is the current bug behavior?
The environments are not stopped, which leads to tens of instances idling in our cluster.
What is the expected correct behavior?
The environment is stopped once the merge request is accepted/closed, which triggers the deletion of the review app.
Related issues
There is a fairly large amount of issues similar to this one, although they are all closed, the described behaviour persists. Multiple entries in forums etc. confirm the correctness of the expected behaviour.