Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PoC: Global/Manifest-level Parameters #1538

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

UnseenWizzard
Copy link
Contributor

@UnseenWizzard UnseenWizzard commented Jul 26, 2024

This is a PoC testing if it's possible to define parameters in the manifest and make them available to all configs - it is.

The middle commit making global parameters actually accessible is where concerns are cut heavily for the PoC:

  1. global params are simply copied into every single configuration to make them directly accessible
  2. this is needed as they're simply accessed as parameters with a magic-string name pattern

This is memory inefficient and hacky.
In the spirit of making things explicit when it comes to Config YAMLs I'd suggest replacing the hack with a dedicated parameter type for accessing global parameters - and making these read from a single copy of the global param map when their ResolveValue is called.

If they are explicitly separated from general Parameters, there is also no risk of overlapping parameter names by accident - and no need to implement extra validation.

To cover #731 the environment a config is for, can similarly be made available as a global parameter available by default.
A dedicated parameter type for accessing global params, would make this even easier, as it can just return the string value - instead of wrapping it in an extra parameter as this PoC does.


Note on test failures:
Several tests assert that configs are created with expected parameters - the addition of the environment name parameter breaks these asserts. As that implementation should IMO not make it out of the PoC phase, the tests are not adapted.

Copy link

github-actions bot commented Jul 26, 2024

Unit Test Results

1 895 tests  +3   1 881 ✅  - 10   27s ⏱️ ±0s
  133 suites ±0       1 💤 ± 0 
    1 files   ±0      13 ❌ +13 

For more details on these failures, see this check.

Results for commit 11f54b8. ± Comparison against base commit bf613e7.

♻️ This comment has been updated with latest results.

…e as a global parameter

As configs are already aware of which environment they are for, this is easy to just
make available like other global parameters.
A dedicated parameter type would simplify access even further, as it can simply return the
config's 'environment' value based on it's resolve context directly
Copy link

sonarcloud bot commented Jul 26, 2024

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.

1 participant