Add logic to populate new destinations when pipeline is created
Problem
When a pipeline is created we need to create ci_job_definitions
records taking in consideration race conditions at project-level.
Proposal
- Use Draft: PoC: split build metadata into `job_prot... (!193948 - closed) as inspiration for the work to do.
- We may need to persist job definitions in bulk and take in consideration race conditions on multiple jobs of the same definition being created for the first time.
- See !193948 (comment 2587555469) for more details on how to approach this.
- This can be particularly frequent when creating a new partition and may concurrent pipelines will race to create the first definition of the partition.
- Ensure persisted environments are stored as direct association with
ci_builds
and intrinsic data about environments stored in thereaction
,deployment_tier
,kubernetes.namespace
). - Use a feature flag
write_to_new_ci_destinations
- the PoC used a feature flagwrite_to_ci_job_prototypes
Edited by Furkan Ayhan