Fix N+1 SQL queries with protected environments
When viewing a specific pipeline, we check whether the user has permission to deploy a build by calling build.project.protected_environment_accessible_to?
. Previously
this led to one SQL query per build in the pipeline.
To fix this, we cache protected environments by name during a request.
Closes #55346 (closed)
Edited by Stan Hu