Optimize code responsible for evaluating pipeline / job variables
Description
Ci::Build#scoped_variables
is responsible for returning all predefined variables that are going to be set in a runner environment.
It is quite slow, it takes around 2s on my local machine, a little more on production currently.
We are calling Gitaly three times there, and there is probably some room for optimization.
Edited by Grzegorz Bizon