Skip to content

Commit

Permalink
Document new feature
Browse files Browse the repository at this point in the history
Signed-off-by: Cristian Le <[email protected]>
  • Loading branch information
LecrisUT committed Oct 7, 2024
1 parent 3a9861e commit d4672f0
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
50 changes: 50 additions & 0 deletions docs/code/plugin-introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ provided in the ``TMT_PLUGINS`` environment variable and from
Consider adding a static type checker (e.g. ``mypy``) in your
plugin's CI using the ``main`` branch of ``tmt``.

.. versionadded:: 1.38
You can use ``tmt.resources`` entry point to inject resource
files to be used for tmt, e.g. schemas or templates. See
:ref:`additional-resources` for more details.


Inheritance
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -62,3 +67,48 @@ features which cannot be covered by generic ssh implementation of
the ``Guest`` class.

__ https://github.com/teemtee/tmt/tree/main/examples/plugins

.. additional-resources:
Additional resource files
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In order to make resource files available to the base ``tmt``
execution, you need to point a ``tmt.resources`` entry point to the
root python package where the resource files are located from, e.g.
with in the ``examples/plugins``:

.. code-block:: toml
:caption: pyproject.toml
:emphasize-lines: 5,6
[project.entry-points."tmt.plugin"]
ProvisionExample = "example.provision:ProvisionExample"
DiscoverExample = "example.discover:DiscoverExample"
[project.entry-points."tmt.resources"]
ResourcesExample = "example"
you can, for example, add a json schema file for the plugins
implemented above by including the schema files under a ``schemas``
folder:

.. code-block:: shell
$ tree ./example
./example
├── __init__.py
├── discover.py
├── provision.py
└── schemas
├── discover
│ └── example.yaml
└── provision
└── example.yaml
.. note::

Both the entry-point entries as well as any resource file
under the ``tmt.resources`` path **must** have unique names.
Consider namespacing all relevant entries with the name of the
project or an unambiguous derivative of it.
7 changes: 7 additions & 0 deletions docs/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
Releases
======================

tmt-1.38.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

External plugins can inject additional resources to be used by tmt using
the ``tmt.resources`` entry-point, e.g. to extend the schema validation
or tmt templates.

tmt-1.37.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down

0 comments on commit d4672f0

Please sign in to comment.