Deploy environment is marked as "stopped" after merging a branch even when it was not a temporary review environment
<!---
Please read this!
Before opening a new issue, make sure to search for keywords in the issues
filtered by the "regression" or "type::bug" label:
- https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=regression
- https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=type::bug
and verify the issue you're about to submit isn't a duplicate.
--->
### Release notes
GitLab environments integrate with Merge Requests, and previously were stopped automatically when the MR got closed or merged. This could lead to erroneous behavior in non-ephemeral or multi-tenant environments. We are adding support to specify that an environment can not be stopped if it does not have a related `on_stop` CI job defined.
Introducing the new behavior, to avoid breaking changes, all existing environments will keep the existing behavior of being allowed to be stopped. At the same time, we are setting new defaults for `environment.deployment_tier: production | staging` environments. For new production and staging environments, the new default value will be to allow stopping an environment only if it has a stop action defined.
In this release, we are adding API support to configure this on stop behavior, UI support coming later.
### Summary
We have a `Deploy into staging` job, which deploys to a `staging` GitLab environment. Any branch is allowed to deploy there. Problem is, when I deploy there from a feature branch and then merge (and delete) said branch, GitLab will mark the `staging` environment as Stopped (and hide it in the UI into the `Stopped` tab). This is misleading, the environment is still running (there is no linked stop job).
Subsequent deploy into that environment brings it back to Active, but that should not be necessary.
### What is the current *bug* behavior?
- Deploy to a non-review environment from a feature branch
- Delete feature branch
- Environment is marked as Stopped (even though there is no `environment.on_stop:` job)
### What is the expected *correct* behavior?
- Deploy to a non-review environment from a feature branch
- Delete feature branch
- Environment is only marked as Stopped when the original deploy job had a `environment.on_stop:` job. Otherwise, the environment stays Active until it's explicitly stopped.
### Proposal
- Add a new setting to `environments` to store the preference between stopping always and stopping only when an action is present - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/173804
- Allow configuring the new setting via API :point_right: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/175940+ & https://gitlab.com/gitlab-org/gitlab/-/merge_requests/176083+
- Update the defaults as described in https://gitlab.com/gitlab-org/gitlab/-/issues/428625#note_2215462417.
- [Follow up] Add new setting to UI
issue