Deploy environment is marked as "stopped" after merging a branch even when it was not a temporary review environment
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 - !173804 (merged) - Allow configuring the new setting via API
👉 Allow configuring "auto_stop_setting" through E... (!175940 - merged) & Allow configuring "auto_stop_setting" through g... (!176083 - merged) - Update the defaults as described in #428625 (comment 2215462417).
- [Follow up] Add new setting to UI