Implement name and sha component context interpolation
What does this MR do and why?
Implement name and sha component context interpolation
This is the second step of adding component context to the
CI interpolation. In the first step, we've prepared the codebase by
refactoring YAML context passing. In this step, we are adding
component.name
and component.sha
to the interpolation. In the next
step, we'll add component.version
.
The documentation will be added in the final step.
This change is behind the feature flag
ci_component_context_interpolation
.
References
Ref | Link |
---|---|
Issue | Components - Allow interpolation to use local c... (#438275) |
Step 1 | Prepare CI interpolation logic for component co... (!205999 - merged) |
Step 2 | <<-- HERE-->> |
Step 3 | Implement version component context interpolation |
Screenshots or screen recordings
Create a project with these files:
templates/component-1.yml
:
spec:
component: [name, sha]
inputs:
compiler:
default: gcc
optimization_level:
type: number
default: 2
---
test:
script:
- echo "Building with $[[ inputs.compiler ]] and optimization level $[[ inputs.optimization_level ]]"
- echo "Component $[[ component.name ]] / $[[ component.sha ]]"
.gitlab-ci.yml
:
include:
- component: gdk.test:3000/components/component-test-project-for-interpolation/component-1@$CI_COMMIT_SHA
ci_component_context_interpolation
enabled
FF
ci_component_context_interpolation
disabled
FF
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Furkan Ayhan