PoC: Create SingleInterpolation classes
What does this MR do and why?
This MR creates a SingleInterpolation
module that contains modified versions of the Interpolator
, Template
, and Config
classes from the Interpolation
module. The modifications implement a single interpolation process, where an entire YAML config is interpolated in one go.
-
SingleInterpolation
uses theInterpolation::Access
,Interpolation::Block
, andInterpolation::Context
classes without any changes - This MR adds a
ci_single_interpolation
feature flag that we can use for a percentage based rollout - Since this is a PoC, it only adds specs to
Yaml::Loader
so we can test at an integration level that the interpolation is working as expected - This MR includes a new
ArrayInput
so we can test that single interpolation works for arrays
Local Testing
- Create a file
included.yml
in the root directory of a project
spec:
inputs:
after_script:
allow_failure:
type: boolean
cleanup:
deploy_job_name:
deploy_script:
type: array
parallel:
type: number
test_script_name:
---
.scripts:
rspec:
- echo "Runs rspec"
cleanup:
- echo "$[[ inputs.cleanup ]]"
test_job:
after_script: $[[ inputs.after_script ]]
parallel: $[[ inputs.parallel ]]
script: !reference [.scripts, "$[[ inputs.test_script_name ]]"]
$[[ inputs.deploy_job_name ]]:
allow_failure: $[[ inputs.allow_failure ]]
script: $[[ inputs.deploy_script ]]
- In the CI Editor, add the following configuration
# .gitlab-ci.yml
include:
- local: included.yml
inputs:
after_script: "!reference [.scripts, cleanup]"
allow_failure: true
cleanup: Cleanup things
deploy_job_name: inputs_deploy
deploy_script:
- echo "Staging deploy from input"
- echo "Prod deploy from input"
parallel: 8
test_script_name: rspec
- The parsed configuration should be:
---
".scripts":
rspec:
- echo "Runs rspec"
cleanup:
- echo "Cleanup things"
test_job:
after_script:
- echo "Cleanup things"
parallel: 8
script:
- echo "Runs rspec"
inputs_deploy:
allow_failure: true
script:
- echo "Staging deploy from input"
- echo "Prod deploy from input"
References
Benchmarking:
-
SingleInterpolation::Template
!136075 (comment 1640719602) -
Loader::Yaml
!136075 (comment 1640901614)
Issue: #411438 (closed)
Previous spike: !132045 (closed)
Edited by Avielle Wolfe