tmt.steps.prepare package
Subpackages
- tmt.steps.prepare.artifact package
- Subpackages
- tmt.steps.prepare.artifact.providers package
- Submodules
- tmt.steps.prepare.artifact.providers.brew module
- tmt.steps.prepare.artifact.providers.copr_build module
- tmt.steps.prepare.artifact.providers.copr_repository module
- tmt.steps.prepare.artifact.providers.file module
- tmt.steps.prepare.artifact.providers.koji module
- tmt.steps.prepare.artifact.providers.repository module
- tmt.steps.prepare.artifact.providers.repository_url module
- Module contents
- tmt.steps.prepare.artifact.providers package
- Module contents
- Subpackages
- tmt.steps.prepare.feature package
- Submodules
- tmt.steps.prepare.feature.crb module
- tmt.steps.prepare.feature.environment_profile module
- tmt.steps.prepare.feature.epel module
- tmt.steps.prepare.feature.fips module
- Module contents
Submodules
tmt.steps.prepare.ansible module
- class tmt.steps.prepare.ansible.PrepareAnsible(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
PreparePlugin[PrepareAnsibleData]Run Ansible playbooks against the guest, by running
ansible-playbookfor all given playbooks.Note
The plugin requires a working Ansible to be available on the test runner.
Warning
When specifying playbooks with paths:
If a metadata tree root exists, all paths must be relative to the metadata tree root.
If the metadata tree root does not exist, all paths must be relative to the current working directory.
Warning
The plugin may be a subject of various limitations, imposed by Ansible itself:
Ansible 2.17+ no longer supports Python 3.6 and older. Guests where Python 3.7+ is not available cannot be prepared with the
ansibleplugin. This has been observed when Fedora Rawhide runner is used with CentOS 7 or CentOS Stream 8 guests. Possible workarounds: downgrade Ansible tmt uses, or install Python 3.7+ before usingansibleplugin from an alternative repository or local build.
Run a single playbook on the guest:
prepare: how: ansible playbook: ansible/packages.yml
prepare --how ansible --playbook ansible/packages.yml
Run multiple playbooks in one phase, with extra arguments for
ansible-playbook:prepare: how: ansible playbook: - one.yml - two.yml extra-args: '-vvv'
prepare --how ansible --playbook one.yml --playbook two.yml --extra-args '-vvv'
Remote playbooks - provided as URLs starting with
http://orhttps://, local playbooks - optionally starting with afile://schema, and playbooks bundled with collections can be referenced as well as local ones, and all kinds can be intermixed:prepare: how: ansible playbook: - https://foo.bar/one.yml - two.yml - file://three.yml - ansible_galaxy_namespace.cool_collection.four
prepare --how ansible --playbook https://foo.bar/two.yml \ --playbook two.yml \ --playbook file://three.yml \ --playbook ansible_galaxy_namespace.cool_collection.four
Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- essential_requires() list[DependencySimple | DependencyFmfId | DependencyFile]
Collect all essential requirements of the plugin.
Essential requirements of a plugin are necessary for the plugin to perform its basic functionality.
- Returns:
a list of requirements.
- go(*, guest: Guest, environment: Environment | None = None, logger: Logger) PluginOutcome
Prepare the guests
- class tmt.steps.prepare.ansible.PrepareAnsibleData(name: str, how: str, order: int = 50, when: list[str] = <factory>, summary: str | None = None, where: list[str] = <factory>, playbook: list[str] = <factory>, extra_args: str | None = None)
Bases:
PrepareStepData- extra_args: str | None = None
- playbook: list[str]
tmt.steps.prepare.distgit module
- class tmt.steps.prepare.distgit.DistGitData(name: str, how: str, order: int = 60, when: list[str] = <factory>, summary: str | None = None, where: list[str] = <factory>, source_dir: tmt._compat.pathlib.Path | None = None, phase_name: str = <factory>, install_builddeps: bool = False, require: list['tmt.base.core.DependencySimple'] = <factory>)
Bases:
PrepareStepData- install_builddeps: bool = False
- order: int = 60
- phase_name: str
- require: list[tmt.base.core.DependencySimple]
- source_dir: Path | None = None
- tmt.steps.prepare.distgit.PHASE_ORDER_PREPARE_DISTGIT_RPMBUILD = 60
Application of patches by
rpm-buildcommand invoked by discover/fmf plugin whendist-git-sourcekey is used.
- class tmt.steps.prepare.distgit.PrepareDistGit(*, discover: DiscoverPlugin[Any] | None = None, future_requires: PreparePlugin[Any] | None = None, future_recommends: PreparePlugin[Any] | None = None, **kwargs: Any)
Bases:
PreparePlugin[DistGitData]Companion to the discover-dist-git, place where
rpmbuild -bphappensStep is responsible: 1. Install required packages for the rpmbuild itself 2. Detect and install build requires 3. Patch sources (rpmbuild -bp) 4. Move patched sources from buildroot into TMT_SOURCE_DIR 5. Call function of discover plugin to discover tests from TMT_SOURCE_DIR
Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- go(*, guest: Guest, environment: Environment | None = None, logger: Logger) PluginOutcome
Prepare the guests for building rpm sources
- tmt.steps.prepare.distgit.insert_to_prepare_step(discover_plugin: DiscoverPlugin[Any], sourcedir: Path) None
Single place to call when inserting PrepareDistGit from discover
tmt.steps.prepare.install module
- class tmt.steps.prepare.install.PrepareInstall(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
PreparePlugin[PrepareInstallData]Install packages on the guest.
Example config:
prepare: how: install copr: psss/tmt package: tmt-all missing: fail
Use
coprfor enabling a desired Copr repository andmissingto choose whether missing packages should be silently ignored (skip) or a preparation error should be reported (fail), which is the default.One or more RPM packages can be specified under the
packageattribute. The packages will be installed on the guest. They can either be specified using their names, paths to local rpm files or urls to remote rpms.# Install local rpms using file path prepare: how: install package: - tmp/RPMS/noarch/tmt-0.15-1.fc31.noarch.rpm - tmp/RPMS/noarch/python3-tmt-0.15-1.fc31.noarch.rpm
# Install remote packages using url prepare: how: install package: - https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm - https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-8.noarch.rpm
# Install the whole directory, exclude selected packages prepare: how: install directory: - tmp/RPMS/noarch exclude: - tmt+all - tmt+provision-virtual
prepare: how: install # Repository with a group owner (@ prefixed) requires quotes, e.g. # copr: "@osci/rpminspect" copr: psss/tmt package: tmt-all missing: skip
Use
directoryto install all packages from given folder andexcludeto skip selected packages (globbing characters are supported as well).prepare: how: install directory: tmp/RPMS/noarch exclude: tmt+provision-virtual
Note
When testing ostree booted deployments tmt will use
rpm-ostreeas the package manager to perform the installation of requested packages. The current limitations of therpm-ostreeimplementation are:Cannot install new version of already installed local rpm.
No support for installing debuginfo packages at this time.
Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- go(*, guest: Guest, environment: Environment | None = None, logger: Logger) PluginOutcome
Perform preparation for the guests
- class tmt.steps.prepare.install.PrepareInstallData(name: str, how: str, order: int = 50, when: list[str] = <factory>, summary: str | None = None, where: list[str] = <factory>, package: list[tmt.base.core.DependencySimple] = <factory>, directory: list[tmt._compat.pathlib.Path] = <factory>, copr: list[str] = <factory>, exclude: list[str] = <factory>, missing: Literal['skip', 'fail'] = 'fail')
Bases:
PrepareStepData- copr: list[str]
- directory: list[Path]
- exclude: list[str]
- missing: Literal['skip', 'fail'] = 'fail'
- package: list[DependencySimple]
tmt.steps.prepare.shell module
- class tmt.steps.prepare.shell.PrepareShell(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
PreparePlugin[PrepareShellData]Prepare guest using shell (Bash) scripts.
Default shell options are applied to the script, see the test key specification for more details.
prepare: how: shell script: - sudo dnf install -y 'dnf-command(copr)' - sudo dnf copr enable -y psss/tmt - sudo dnf install -y tmt
Scripts can also be fetched from a remote git repository. Specify the
urlfor the repository and optionallyrefto checkout a specific branch, tag or commit.TMT_PREPARE_SHELL_URL_REPOSITORYwill hold the value of the repository path.prepare: how: shell url: https://github.com/teemtee/tmt.git ref: main script: cd $TMT_PREPARE_SHELL_URL_REPOSITORY && make docs
Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- go(*, guest: Guest, environment: Environment | None = None, logger: Logger) PluginOutcome
Prepare the guests
- class tmt.steps.prepare.shell.PrepareShellData(name: str, how: str, order: int = 50, when: list[str] = <factory>, summary: str | None = None, where: list[str] = <factory>, script: list[tmt.utils.ShellScript] = <factory>, url: str | None = None, ref: str | None = None)
Bases:
PrepareStepData- ref: str | None = None
- script: list[ShellScript]
- to_minimal_spec() dict[str, Any]
Convert to specification, skip default values
See https://tmt.readthedocs.io/en/stable/code/classes.html#class-conversions for more details.
See
from_spec()for its counterpart.
- to_spec() dict[str, Any]
Convert to a form suitable for saving in a specification file
- url: str | None = None
tmt.steps.prepare.verify_installation module
- class tmt.steps.prepare.verify_installation.PrepareVerifyInstallation(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
PreparePlugin[PrepareVerifyInstallationData]Verify that installed packages came from expected repositories.
Currently only supports DNF-based package managers (
dnf,dnf5). Other package managers will cause the step to fail with an unsupported error.Packages pre-installed in a container image (or otherwise not installed via a repository) report an unknown source. Such packages are attributed to
<unknown>and can be matched by specifying'<unknown>'as the expected repository in the verification mapping.Verification failures are recorded as
FAILresults in the prepare phase output and cause the prepare step to fail, preventing test execution.Each package may specify a single expected repository (string) or a list of acceptable repositories. A package passes if its actual source matches any of the listed repos.
Example usage:
prepare: how: verify-installation verify: make: tmt-artifact-shared gcc: fedora curl: - tmt-artifact-shared - updates
Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- go(*, guest: Guest, environment: Environment | None = None, logger: Logger) PluginOutcome
Perform package source verification.
- class tmt.steps.prepare.verify_installation.PrepareVerifyInstallationData(name: str, how: str, order: int = 79, when: list[str] = <factory>, summary: str | None = None, where: list[str] = <factory>, verify: dict[str, list[str]] = <factory>)
Bases:
PrepareStepData- order: int = 79
- verify: dict[str, list[str]]
Module contents
- class tmt.steps.prepare.DependencyCollection(guests: list[~tmt.guest.Guest], dependencies: list[~tmt.base.core.DependencySimple] = <factory>)
Bases:
objectBundle guests and packages to install on them
- property as_key: frozenset[DependencySimple]
- dependencies: list[DependencySimple]
- class tmt.steps.prepare.Prepare(*, plan: Plan, raw_data: list[_RawStepData], logger: Logger)
Bases:
StepWithQueue[PrepareStepData,PluginOutcome]Prepare the environment for testing.
Use the ‘order’ attribute to select in which order preparation should happen if there are multiple configs. Default order is ‘50’. Default order of required packages installation is ‘70’, for the recommended packages it is ‘75’.
Initialize prepare step data
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- cli_invocations: list['tmt.cli.CliInvocation'] = []
- go(force: bool = False) None
Prepare the guests
- load() None
Load status and step data from the workdir
- results: list[PhaseResult]
- save() None
Save status and step data to the workdir
- summary() None
Give a concise summary of the preparation
- wake() None
Wake up the step (process workdir and command line)
- class tmt.steps.prepare.PreparePlugin(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
Plugin[PrepareStepDataT,PluginOutcome]Common parent of prepare plugins
Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- go(*, guest: Guest, environment: Environment | None = None, logger: Logger) PluginOutcome
Prepare the guest (common actions)
- class tmt.steps.prepare.PrepareStepData(name: str, how: str, order: int = 50, when: list[str] = <factory>, summary: str | None = None, where: list[str] = <factory>)
Bases:
WhereableStepData,StepData