-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add: Use external toml file for plugin configuration #706
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Conventional Commits Report
🚀 Conventional commits found. |
ghost
force-pushed
the
poc_plugins_config_file
branch
2 times, most recently
from
May 15, 2024 12:10
cb89348
to
70c0d1a
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #706 +/- ##
==========================================
- Coverage 79.51% 79.48% -0.04%
==========================================
Files 86 86
Lines 2910 2944 +34
Branches 611 616 +5
==========================================
+ Hits 2314 2340 +26
- Misses 450 457 +7
- Partials 146 147 +1 ☔ View full report in Codecov by Sentry. |
mbrinkhoff
requested changes
Jun 3, 2024
amy-gb
reviewed
Jun 14, 2024
amy-gb
reviewed
Jun 14, 2024
amy-gb
reviewed
Jun 14, 2024
mbrinkhoff
requested changes
Jun 17, 2024
ghost
force-pushed
the
poc_plugins_config_file
branch
from
June 19, 2024 06:40
06ec035
to
69c69b2
Compare
NiklasHargarter
force-pushed
the
poc_plugins_config_file
branch
from
July 2, 2024 10:58
69c69b2
to
b681049
Compare
n-thumann
reviewed
Jul 2, 2024
n-thumann
reviewed
Jul 4, 2024
n-thumann
reviewed
Jul 4, 2024
n-thumann
reviewed
Jul 5, 2024
NiklasHargarter
force-pushed
the
poc_plugins_config_file
branch
from
July 8, 2024 07:33
8d4f40c
to
de8d0b7
Compare
1 task
Rewrite http_links_in_tags plugin to use external config for exclusions
…nitializition - directory_type no longer allows non-existent directories - Plugin method validate_and_extract_plugin_config split into separate methods with different responsibilities
NiklasHargarter
force-pushed
the
poc_plugins_config_file
branch
from
August 9, 2024 10:07
2c291d1
to
81961da
Compare
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Use an external toml file to store plugin configurations.
Rewrite http_links_in_tags plugin to use external config for exclusions as a demonstration of how other plugins can use it.
The location of the file is specified by the --plugins-config-file command-line argument added to the parser.
This argument has a default value of 'troubadix_config.toml'. This is the same as the config file in the vt repo.
This makes this release compatible with all old workflows and aliases that use Troubadix, as long as the new config file is present.
Otherwise, a different file must be specified, as Troubadix will no longer be able to run without a valid config file.
If no plugin is being run that uses external configuration, an empty but existing file is sufficient to be valid.
This is done to make it less likely that Troubadix will run without a configuration when it should have one.
This file must have an entry with the same name as the plugins Plugin.name attribute for each plugin that is executed during the Troubadix run that uses the new system.
Plugins that are not executed or that do not use the new system do not need an entry in the toml file.
The values of the plugin entries can be any valid Toml structure that can be parsed into Python types.
This should allow the configuration of most plugins.
For example, http_tags_in_link just wants a list of exclusions. Which maps 1 to 1 from toml to python.
Plugins must use a class attribute to indicate if they depend on an external configuration. If nothing is set, as in existing plugins, the default of False is used. And then none of the new changes will apply to this plugin. Its function remains the same.
Plugins that use external config are passed the entire config, and are responsible for validating and extracting only the parts they want. They can then access the config via an instance attribute `config
Why
The purpose is to unify the configuration for all Troubadix plugins that are use case dependent / come from outside Troubadix.
Exclusion changes that are necessary for VT development, but do not change the Troubadix plugins, can then be part of the same PR that introduces the VT, and not require an additional Troubadix PR anymore.
Changes for VT Development
Rollout Step1
A toml file must be placed in the VT repository that contains all configuration for plugins that use the new file.
Rollout Step2
If a config file from a location other than the default location is to be used for QA, the troubadix invocation must be changed to reflect this.
Changes to config during normal VT development
Changes to the configuration of plugins that use the new system must be made in the vt repo toml file, not in Troubadix.
Changes to the config of plugins that have not yet been converted still need a Troubadix PR.
Converting existing plugins / Creating new Plugin with external config
Set class attribute
requires_external_config = True
Override
validate_plugin_config
of the 'Plugin' base class.Access config via
self.config["key"]
.References
VTOPS-115
Checklist