Skip to content

Conversation

elainezhao1
Copy link
Contributor

This PR introduces hierarchical configuration support in Image Customizer, allowing users to compose configs on top of one another via the .baseConfigs field.

Implement circular dependency detection
Create config inheritance chain resolution
include fields below:

  • .input.image
  • .output.image
  • .output.artifacts

Checklist

  • Tests added/updated
  • Documentation updated (if needed)
  • Code conforms to style guidelines

@elainezhao1 elainezhao1 requested a review from a team as a code owner October 2, 2025 16:04
},
}

current := &imagecustomizerapi.Config{
Copy link
Contributor

@himaja-kesari himaja-kesari Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try creating some configs without the artifacts path field the test would fail with null pointer exception at ResolveOverrideFields_


// ResolvedConfig represents a resolved config and chain of base configs.
type ResolvedConfig struct {
Config *imagecustomizerapi.Config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't reuse the imagecustomizerapi.Config type for the resolved/merged/overridden fields. Instead put all the resolved fields directly in ResolvedConfig.

This will make it explicit which fields are actually resolved. That is, you won't have a bunch of empty values within the Config field.

osPackages []OsPackage
cosiBootMetadata *CosiBootloader

baseConfigs []imagecustomizerapi.BaseConfig
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Store the full resolvedConfig in ImageCustomizerParameters. In the future, we can gradually move features from using imagecustomizerapi.Config to using ResolvedConfig instead.

}

func (r *ResolvedConfig) resolveOverrideFields() {
for _, cfg := range r.InheritanceChain {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it, for interlaced operations and simple merges, following the InheritanceChain ordering is probably fine.

Though, it's possible that for more complex merges, we may want to merge following the tree structure. So, it might be good to store the tree as well as the chain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants