Add auto stop setting to environments
What does this MR do and why?
Add auto stop setting to environments
Currently environments are stopped when a merge request is closed or branch is deleted, even if there is no associated stop job. This setting will be used to allow users to switch between this behaviour and only stopping when a stop job is present.
There is no change in behaviour with this MR. Next, this field will be added to the API to allow users to set their preference.
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
- Create a project, and add the following
gitlab-ci.ymlto a new branch (not the default branch):stages: - deploy deploy: stage: deploy environment: $CI_COMMIT_SHORT_SHA script: - echo 'test' - Create an MR from the branch above.
- Merge the MR, checking "delete source branch"
- Go to Operate -> Environments and verify the environment that was just created is stopped (due to stop setting "always").
- [Optional] In a Rails console, update the setting to "with action" (
update!(auto_stop_setting: :with_action)) and repeat the above steps. This time the environment should not be stopped when the branch is deleted.
Related to #428625 (closed)