Fix component multi-version verification #1100
Merged
+106
−54
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We need to check whether a component instance that sets a custom version supports per-instance versions by checking the instance's target's parameters. The bootstrap target ("cluster") doesn't have any instance-specific parameters, but since we do the validation after setting up all instance targets, we can use the instance's target to read
_metadata
of the alias's version to properly validate that both the base component and the alias are multi-version aware.Additionally, because
component compile
doesn't have the regular bootstrap target (and generating it just for alias validation seems a bit overkill), we make thebootstrap_target
key an optional parameter forverify_component_aliases()
and set it to the component that's being compiled forcomponent compile
and fall back toconfig.inventory.boostrap_target
when it's not set.We also adjust all tests that cover
verify_component_aliases()
to pass a Kapitan/reclass inventory dict instead of just a parameters dict and update the test inputs to set the alias_metadata
in the component parameters key instead of the instance parameters key to replicate the structure that we generate forcatalog compile
.Checklist
bug
,enhancement
,documentation
,change
,breaking
,dependency
,internal
as they show up in the changelog