Efficiently get a related environment in `Ci::Build`
Problem
When Ci::Build
gets an associated environment record, it works like
- Expand environment name with secret variables
- Find a relevant environment record with the expanded name
This leaves us a significant ~performance issue. When users see a pipeline list via ../pipeline.json
endpoint, all build records have to expand variables at first in order to get the environment instance, in the result, it takes long time to forge the complete result and present it to users.
Since we changed the life cycle of Deployment
in %11.5, today we can find environment records much more efficient way without expanding scoped variables.
Proposal
- Use
build.deployment.environment
instead ofbuild.persisted_environment
Edited by Shinya Maeda