Skip to content

Override complex variables with target overrides instead of merging - #1567

Merged
andrewnester merged 3 commits into
mainfrom
merge-complex-vars
Jul 4, 2024
Merged

Override complex variables with target overrides instead of merging#1567
andrewnester merged 3 commits into
mainfrom
merge-complex-vars

Conversation

@andrewnester

Copy link
Copy Markdown
Contributor

Changes

At the moment we merge values of complex variables while more expected behaviour is overriding the value with the target one.

Tests

Added unit test

Comment threadgo.mod Outdated
Comment threadbundle/config/root.go
@andrewnester
andrewnester requested a review from pieternJuly 4, 2024 10:20
Comment threadbundle/config/root.go
vDefault := variable.Get("default")
if vDefault.Kind() != dyn.KindInvalid {
defaultPath := varPath.Append(dyn.Key("default"))
root, err = dyn.SetByPath(root, defaultPath, vDefault)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you define a variable in a target that is not defined at the root level, this will fail with a poor error message.

How can we best deal with this?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

We have a call to validateVariableOverrides prior to this which does this validation and returns variable X is not defined but is assigned a value

@andrewnester
andrewnester requested a review from pieternJuly 4, 2024 11:29

@pieternpietern left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

@andrewnester
andrewnester added this pull request to the merge queueJul 4, 2024
Merged via the queue into main with commit 040b374Jul 4, 2024
@andrewnester
andrewnester deleted the merge-complex-vars branch July 4, 2024 12:09
andrewnester added a commit that referenced this pull request Jul 10, 2024
Bundles:
* Override complex variables with target overrides instead of merging ([#1567](#1567)).
* Rewrite local path for libraries in foreach tasks ([#1569](#1569)).
* Change SetVariables mutator to mutate dynamic configuration instead ([#1573](#1573)).
* Return early in bundle destroy if no deployment exists ([#1581](#1581)).
* Let notebook detection code use underlying metadata if available ([#1574](#1574)).
* Remove schema override for variable default value ([#1536](#1536)).
* Print diagnostics in 'bundle deploy' ([#1579](#1579)).
Internal:
* Update actions/upload-artifact to v4 ([#1559](#1559)).
* Use Go 1.22 to build and test ([#1562](#1562)).
* Move bespoke status call to main workspace files filer ([#1570](#1570)).
* Add new template ([#1578](#1578)).
* Add regression tests for CLI error output ([#1566](#1566)).
Dependency updates:
* Bump golang.org/x/mod from 0.18.0 to 0.19.0 ([#1576](#1576)).
* Bump golang.org/x/term from 0.21.0 to 0.22.0 ([#1577](#1577)).
@andrewnesterandrewnester mentioned this pull request Jul 10, 2024
github-merge-queueBot pushed a commit that referenced this pull request Jul 10, 2024
Bundles:
* Override complex variables with target overrides instead of merging
([#1567](#1567)).
* Rewrite local path for libraries in foreach tasks
([#1569](#1569)).
* Change SetVariables mutator to mutate dynamic configuration instead
([#1573](#1573)).
* Return early in bundle destroy if no deployment exists
([#1581](#1581)).
* Let notebook detection code use underlying metadata if available
([#1574](#1574)).
* Remove schema override for variable default value
([#1536](#1536)).
* Print diagnostics in 'bundle deploy'
([#1579](#1579)).
Internal:
* Update actions/upload-artifact to v4
([#1559](#1559)).
* Use Go 1.22 to build and test
([#1562](#1562)).
* Move bespoke status call to main workspace files filer
([#1570](#1570)).
* Add new template
([#1578](#1578)).
* Add regression tests for CLI error output
([#1566](#1566)).
Dependency updates:
* Bump golang.org/x/mod from 0.18.0 to 0.19.0
([#1576](#1576)).
* Bump golang.org/x/term from 0.21.0 to 0.22.0
([#1577](#1577)).
denik pushed a commit that referenced this pull request May 20, 2026
…1567)
## Changes
At the moment we merge values of complex variables while more expected
behaviour is overriding the value with the target one.
## Tests
Added unit test
denik pushed a commit that referenced this pull request May 20, 2026
Bundles:
* Override complex variables with target overrides instead of merging
([#1567](#1567)).
* Rewrite local path for libraries in foreach tasks
([#1569](#1569)).
* Change SetVariables mutator to mutate dynamic configuration instead
([#1573](#1573)).
* Return early in bundle destroy if no deployment exists
([#1581](#1581)).
* Let notebook detection code use underlying metadata if available
([#1574](#1574)).
* Remove schema override for variable default value
([#1536](#1536)).
* Print diagnostics in 'bundle deploy'
([#1579](#1579)).
Internal:
* Update actions/upload-artifact to v4
([#1559](#1559)).
* Use Go 1.22 to build and test
([#1562](#1562)).
* Move bespoke status call to main workspace files filer
([#1570](#1570)).
* Add new template
([#1578](#1578)).
* Add regression tests for CLI error output
([#1566](#1566)).
Dependency updates:
* Bump golang.org/x/mod from 0.18.0 to 0.19.0
([#1576](#1576)).
* Bump golang.org/x/term from 0.21.0 to 0.22.0
([#1577](#1577)).
Sign up for freeto 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.

2 participants

@andrewnester@pietern