From c68683efbcb18ebc4ce62e563c3d98e6324ce0f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Prchl=C3=ADk?= Date: Fri, 9 Jan 2026 10:14:45 +0100 Subject: [PATCH 1/5] Plugin envvars take effect even when plugin is not mentioned on CLI This was a major drawback when using envvars to populate or change phases' configuration: plugin-specific envvars had no effect unless the plugin was invoked via command line. This was caused by Click consuming them, and without mentioning the plugin on command line, Click was not invoked, therefore nothing consumed said envvars. The patch adds one more pass into the application of CLI invocations where we collect all these envvars, and then we use Click to process them. The produced values are then added into raw step data. We do not use custom parsers or type casting, we identify the plugin in question from the envvar name, and use its Click command and its parameters to perform the necessary steps for us. This should be equivalent to what Click does when crunching the command line. --- tmt/steps/__init__.py | 104 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/tmt/steps/__init__.py b/tmt/steps/__init__.py index 22fe13c46b..e248484eaf 100644 --- a/tmt/steps/__init__.py +++ b/tmt/steps/__init__.py @@ -61,6 +61,7 @@ Command, CommandOutput, Environment, + EnvVarName, EnvVarValue, GeneralError, HasPhaseWorkdir, @@ -132,6 +133,11 @@ CODE_BLOCK_REGEXP = re.compile(r"^\s*\.\. code-block::.*$\n", re.MULTILINE) +#: A regular expression to cut the special, plugin-specific environment +#: variable names into their components: step, plugin, and option names. +PLUGIN_ENVIRONMENT_VARIABLE_NAME_PATTERN = re.compile( + r'TMT_PLUGIN_(?P[A-Z]+)_(?P[A-Z]+)_(?P