Record stop actions of deployments
Problem
We don't currently persist deployments records if it's action: stop. This causes a performance issue as a job needs to expand_environment_name to get an associated environment (#persisted_environment). We should start persisting deployments for stop actions as well, in order to make it performant.
Proposal
Some idea from @ayufan
- Maybe we can use
build_metadata. - We have a plan to move majority of things to
build_metadata - stop action is an annotation of CI Build action
- Maybe better is to introduce a new one in
ci_build_metadatawhich isenvironment_name+environment_action? - We could use
env_namewhen present otherwise expand env name? - With my policy of killing older CI builds (like 3 months) the problem of
ci_builds.envwould go away in 3-5 months from now. - the idea of that is that we can drop it when we don’t need it anymore and loose retrying capabilities, thus some annotations
- env+action fits into that description
Related: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22861
Edited by Shinya Maeda