Allow expanding variables in Rails by topologically sorting them
requested to merge pedropombeiro/26345-expand-runner-variables into pedropombeiro/26345-variable_inside_variable-scoped-FF
pedropombeiro/26345-variable_inside_variable-scoped-FF
branch, please change to master
before merging
What does this MR do?
- Adds a
expand_runner_variables
function toExpandVariables
to perform a full expansion of a runner variable array, gated by the new project-scoped:variable_inside_variable
feature flag. It will return the original variables if a cyclic reference is detected; - Modifies the
transform_variables
/match_or_blank_value
private functions to work with a hash of variables, instead of hash of variable values. This allows us to check for the:protected
flag to make a decision on whether to expand the variable. - Changes
Sorted.each_variable_reference
so that it doesn't take into consideration references to protected variables. - Adds tests for new functionality for both feature flag disabled and enabled cases (cyclic reference detection, topological sorting expectations, variable expansion).
- Per Kamil's suggestion, removes code that handles Windows-style variable references (
%
).
Screenshots (strongly suggested)
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Part of gitlab-runner#26345 (closed)
Edited by Pedro Pombeiro