Skip to content
This repository has been archived by the owner on Dec 21, 2019. It is now read-only.

Refactor, document and test value merging logic #147

Merged
merged 4 commits into from
Jun 26, 2018

Conversation

tazjin
Copy link
Owner

@tazjin tazjin commented Jun 26, 2018

Please see the individual commit messages in this pull request for additional information.

This relates to the discussion in issue #142. I've published a pre-release build of this version here (tarball includes builds for Linux, Darwin, FreeBSD and Windows).

cc: @merlineus @Arttii @tommyJimmy87

tazjin added 4 commits June 26, 2018 12:30
Changes the logic for merging context values to be unambiguous and
easy to follow.

* loadDefaultVars returns the default vars directly instead of
  performing merging in addition
* all merging is performed in `mergeContextValues` using explicit
  explanations for every step of the merge.

After this commit the order of merging goes from least to most
"specific", please read the explanatory comments for more information.

This relates to #142.
Introduces a test which will merge variables defined at every possible
layer together and ensure that the loaded context configuration is as
expected.

The test data provides an actual resource set template that can be
tested locally from a kontemplate source checkout:

    kontemplate template context/testdata/merging/context.yaml --var cliVar=cliVar
@Arttii
Copy link

Arttii commented Jun 26, 2018

I tested the branch. Its very understandable now from the comments, and the behavior is the one we were aiming for. Thanks for the fix!!!

@tazjin
Copy link
Owner Author

tazjin commented Jun 26, 2018

@Arttii Thank you! I'm going to wait for feedback from @merlineus, too.

@dermyrddin
Copy link

Yeah!
Thanks for quick reaction. Overriding behaviour is now logical and clear for understanding :)

@tazjin tazjin merged commit 6b39254 into master Jun 26, 2018
@dermyrddin
Copy link

@tazjin do you plan to release a minor version with this change? Maybe 1.6.1?

@tazjin
Copy link
Owner Author

tazjin commented Jun 27, 2018

@merlineus No, but I'm planning to release a major version with it (1.7.0) ;-)

Waiting to see if @tommyJimmy87 (who filed the original issue) has more input before moving forward.

@tazjin tazjin deleted the refactor/sound-value-merging branch June 27, 2018 16:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants