Environment variables
Exposed by tmt
The following sections describe various sets of environment variables
exposed by tmt to various user-provided actions - scripts and commands
provided by the user via plan and test metadata keys, from
prepare/shell scripts to individual tests. Sets of environment
variables are listed in their order of precedence from least to greatest:
the last listed variables override variables from previous set.
1. User-provided test environment
As set via environment key of individual tests.
2. User-provided plan environment
2.1. environment-file plan key
Environment variables loaded from files listed in the
environment-file plan key.
2.2. environment plan key
Environment variables set via environment plan key.
3. Environment inherited from the importing plan
Note
These sets of environment variables exist only when the plan has been imported. Local plans do not have an importing plan, and have no plan to inherit environment from.
3.1. Importing plan’s environment-file plan key
Environment variables loaded from files listed in the importing plan’s environment plan key.
3.2. Importing plan’s environment plan key
Environment variables set via importing plan’s environment plan key.
3.3. Importing plan’s importing plan
This set is the recursive aspect of the inherited environment:
An imported plan
/Ainherits the aforementioned environment variables from its importing plan,/B.Said importing plan,
/B, might have been an imported plan as well, imported by a plan called/C. This makes/Cthe importing plan of/B, and/Bitself inherits the aforementioned environment variables from its importing plan,/C. These variables are then inherited by/A.
The chain of importing plans is followed to its end, until there is no importing plan to inherit from.
4. User-provided guest environment
As set via environment key of
individual provision phases. Applies to user commands executed on
the given guest.
5. User-controlled plan environment file
Environment variables loaded from a file the TMT_PLAN_ENVIRONMENT_FILE
environment variable points at.
6. User-provided environment from command-line
6.1 tmt run command-line
6.1.1 Command-line options from the previous tmt run invocation
Environment variables saved in the run directory by a previous tmt run
invocation.
6.1.2 --environment-file option
Environment variables loaded from files referenced by the tmt run --environment-file
command-line option.
6.1.3 --environment option
Environment variables set via tmt run --environment command-line option.
Note
This set includes also files with environment variables when such
files are given to tmt run --environment using the @<filepath>
form.
7. Variables exposed by tmt, run, plan, steps, plugins, and test frameworks
These are the strongest sets of environment variables, always overriding preexisting ones.
The variables here are not ordered by their order of precedence. They are owned and exposed by various tmt internal components and subsystems, and they do not conflict with each other. From the user perspective, they behave as a single set which overrides variables from all the previous sets, and their internal ordering is not relevant.
Instead, they are grouped by plan steps, with notes mentioning possible limitations.
discoverTMT_PLAN_DATATMT_PLAN_ENVIRONMENT_FILETMT_PLAN_SOURCE_SCRIPTTMT_TREETMT_VERSION
provisionTMT_PLAN_DATATMT_PLAN_ENVIRONMENT_FILETMT_PLAN_SOURCE_SCRIPTTMT_TREETMT_VERSION
prepareREBOOTCOUNTRSTRNT_REBOOTCOUNTTMT_TEST_PIDFILETMT_TEST_PIDFILE_LOCKTMT_TEST_PIDFILE_ROOTTMT_PLAN_DATATMT_PLAN_ENVIRONMENT_FILETMT_PLAN_SOURCE_SCRIPTTMT_PREPARE_SHELL_URL_REPOSITORYNote
Only to the
prepare/shellphases.TMT_REBOOT_REQUESTTMT_REBOOT_COUNTTMT_TEST_RESTART_COUNTTMT_TOPOLOGY_BASHTMT_TOPOLOGY_YAMLTMT_TREETMT_VERSION
executeBEAKERLIB_DIRNote
Only when a test with the
beakerlibframework runs.BEAKERLIB_COMMAND_SUBMIT_LOGNote
Only when a test with the
beakerlibframework runs.BEAKERLIB_COMMAND_REPORT_RESULTNote
Only when a test with the
beakerlibframework runs.IN_PLACE_UPGRADENote
To the
execute/upgradephases only.RSTRNT_REBOOTCOUNTRSTRNT_TASKNAMETESTIDNote
Only when a test with the
beakerlibframework runs.TMT_TEST_PIDFILETMT_TEST_PIDFILE_LOCKTMT_TEST_PIDFILE_ROOTTMT_PLAN_DATATMT_PLAN_ENVIRONMENT_FILETMT_PLAN_SOURCE_SCRIPTTMT_REBOOT_COUNTTMT_REBOOT_REQUESTTMT_RESTRAINT_COMPATIBLETMT_SOURCE_DIRTMT_TEST_DATATMT_TEST_INVOCATION_PATHTMT_TEST_ITERATION_IDTMT_TEST_METADATATMT_TEST_NAMETMT_TEST_RESTART_COUNTTMT_TEST_SERIAL_NUMBERTMT_TEST_SUBMITTED_FILESTMT_TOPOLOGY_BASHTMT_TOPOLOGY_YAMLTMT_TREETMT_VERSION
finishREBOOTCOUNTRSTRNT_REBOOTCOUNTTMT_TEST_PIDFILETMT_TEST_PIDFILE_LOCKTMT_TEST_PIDFILE_ROOTTMT_PLAN_DATATMT_PLAN_ENVIRONMENT_FILETMT_PLAN_SOURCE_SCRIPTTMT_PREPARE_SHELL_URL_REPOSITORYNote
Only to the
finish/shellphases.TMT_REBOOT_REQUESTTMT_REBOOT_COUNTTMT_TEST_RESTART_COUNTTMT_TOPOLOGY_BASHTMT_TOPOLOGY_YAMLTMT_TREETMT_VERSION
Consumed by tmt itself
Note
The following environment variables are set for and consumed by tmt process itself, and never propagated to user environment.
NO_COLORTMT_BOOT_TIMEOUTTMT_CONNECT_TIMEOUTTMT_CONFIG_DIRTMT_DEBUGTMT_DOWNLOAD_ATTEMPTSTMT_DOWNLOAD_INTERVALTMT_EXPOSABLE_RUNNER_DEVICESTMT_FEELING_SAFETMT_FORCE_COLORTMT_GIT_CLONE_ATTEMPTSTMT_GIT_CLONE_INTERVALTMT_GIT_CLONE_TIMEOUTTMT_GIT_CREDENTIALS_URL_<suffix>TMT_GIT_CREDENTIALS_VALUE_<suffix>TMT_NO_COLORTMT_OUTPUT_WIDTHTMT_PLUGIN_${STEP}_${PLUGIN}_${OPTION}TMT_PLUGINSTMT_POLICY_FILETMT_POLICY_NAMETMT_POLICY_ROOTTMT_REBOOT_TIMEOUTTMT_REPORT_ARTIFACTS_URLTMT_RETRY_SESSION_BACKOFF_FACTORTMT_RETRY_SESSION_BACKOFF_MAXTMT_RETRY_SESSION_RETRIESTMT_SCRIPTS_DIRTMT_SHOW_TRACEBACKTMT_SSH_*TMT_STATE_FORMATTMT_WORKDIR_ROOT