Remove deployments/environments dependency on build metadata
Context
As part of the deployment/environment lifecycle, we need to refer back to the various options defined under the environment:
keyword in the deployment job's CI template. This information is currently stored as metadata for the job itself (Ci::BuildMetadata
). The problem with this is that the environment options and the rest of the metadata have different data retention requirements, and storing them in the same place prevents both from implementing their desired strategy. The goal here is to store the environment metadata separately, allowing it to be managed independently.
Proposal
- Identify which environment/deployment options are required after a job has finished and can no longer be retried.
- Create a new table, for example
deployment_metadata
, to store these options. - Copy relevant data from build data across to the new table. We may not want/need to copy data for every single deployment job, only those that could realistically be required again in the future. For example, some environments have tens of thousands of deployments accumulated over several years, and it is fair to assume that these old deployments will not change state again.
- Move non-critical data from deployments to the new table.
- Implement a retention strategy to remove metadata once it is no longer required on an ongoing basis.
Status update
-
ci_builds_metadata.environment_auto_stop_in
was addressed in Use auto_stop_in value from options instead of ... (!194669 - merged)✅ -
ci_builds_metadata.expanded_environment_name
will be addressed in Use direct relationship between Pipeline Job an... (#326445)⏳ - metadata into
ci_builds_metadata.options
will be addressed in Copy deployment intrinsic data outside `options` (#552372 - closed)⏳
Edited by Fabio Pitino