Skip to content

Commit 718c4e4

Browse files
mcasquerpsss
andauthored
Deduplicate the finish step documentation (#3536)
Signed-off-by: mcasquer <[email protected]> Co-authored-by: Petr Šplíchal <[email protected]>
1 parent 4c3a560 commit 718c4e4

File tree

4 files changed

+37
-57
lines changed

4 files changed

+37
-57
lines changed

docs/plugins/finish-header.inc.rst

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
The :ref:`/spec/plans/finish` step plugins implement actions to be
2+
performed after the test execution has been completed. These can
3+
be useful for finishing tasks such as an additional guest cleanup
4+
or uploading specific logs to an external server.

spec/plans/finish.fmf

+9-47
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,19 @@ summary: Finishing tasks
22

33
description:
44
Additional actions to be performed after the test execution
5-
has been completed. Counterpart of the ``prepare`` step
6-
useful for various cleanup actions. Use the
7-
:ref:`/spec/core/order` attribute to select in which order
8-
finishing tasks should happen if there are multiple configs.
9-
Default order is ``50``.
5+
has been completed. Counterpart of the
6+
:ref:`/spec/plans/prepare` step, useful for various cleanup
7+
actions. For more information about available options see the
8+
:ref:`/plugins/finish` section.
109

1110
example: |
1211
finish:
13-
how: shell
12+
- how: shell
1413
script: upload-logs.sh
15-
16-
/shell:
17-
summary:
18-
Perform finishing tasks using shell (bash) scripts
19-
description:
20-
Execute arbitrary shell commands to finish the testing.
21-
22-
Default shell options are applied to the script, see the
23-
:ref:`/spec/tests/test` key specification for more
24-
details.
25-
26-
example: |
27-
finish:
28-
how: shell
29-
script:
30-
- upload-logs.sh || true
31-
- rm -rf /tmp/temporary-files
32-
link:
33-
- implemented-by: /tmt/steps/finish/shell.py
34-
35-
/ansible:
36-
summary:
37-
Perform finishing tasks using ansible
38-
description: |
39-
One or more playbooks can be provided as a list under the
40-
``playbook`` attribute. Each of them will be applied
41-
using ``ansible-playbook`` in the given order. The path
42-
must be relative to the metadata tree root.
43-
44-
Remote playbooks can be referenced as well as the local ones,
45-
and both kinds can be used at the same time.
46-
47-
example: |
48-
finish:
49-
how: ansible
50-
playbook:
51-
- playbooks/common.yml
52-
- playbooks/os/rhel7.yml
53-
- https://foo.bar/rhel7-final-touches.yml
54-
link:
55-
- implemented-by: /tmt/steps/finish/ansible.py
14+
- how: ansible
15+
playbook: playbooks/cleanup.yaml
16+
link:
17+
- implemented-by: /tmt/steps/finish
5618

5719
/where:
5820
summary: Perform finishing tasks on selected guests

tmt/steps/finish/ansible.py

+15-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ class FinishAnsible(
99
tmt.steps.finish.FinishPlugin[tmt.steps.finish.FinishStepData], PrepareAnsible
1010
):
1111
"""
12-
Perform finishing tasks using ansible
12+
Perform finishing tasks using ansible.
13+
14+
One or more playbooks can be provided as a list under the ``playbook``
15+
attribute. Each of them will be applied using ``ansible-playbook`` in
16+
the given order. The path must be relative to the metadata tree root.
17+
18+
Remote playbooks can be referenced as well as the local ones,
19+
and both kinds can be used at the same time.
1320
1421
.. warning::
1522
@@ -39,13 +46,14 @@ class FinishAnsible(
3946
finish:
4047
how: ansible
4148
playbook:
42-
- playbook/one.yml
43-
- playbook/two.yml
44-
- playbook/three.yml
49+
- playbooks/common.yml
50+
- playbooks/os/rhel9.yml
51+
- https://foo.bar/rhel9-final-touches.yml
4552
46-
The playbook path should be relative to the metadata tree root.
47-
Use 'order' attribute to select in which order finishing tasks
48-
should happen if there are multiple configs. Default order is '50'.
53+
The playbook path should be relative to the metadata tree root. Use
54+
the :ref:`/spec/core/order` attribute to select in which order
55+
finishing tasks should happen if there are multiple configs. Default
56+
order is ``50``.
4957
"""
5058

5159
# We are reusing "prepare" step for "finish",

tmt/steps/finish/shell.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ def to_spec(self) -> dict[str, Any]: # type: ignore[override]
4141
@tmt.steps.provides_method('shell')
4242
class FinishShell(tmt.steps.finish.FinishPlugin[FinishShellData]):
4343
"""
44-
Perform finishing tasks using shell (bash) scripts
44+
Perform finishing tasks using shell (bash) scripts.
45+
46+
Execute arbitrary shell commands to finish the testing.
47+
Default shell options are applied to the script, see the
48+
:ref:`/spec/tests/test` key specification for more
49+
details.
4550
4651
Example config:
4752
@@ -53,8 +58,9 @@ class FinishShell(tmt.steps.finish.FinishPlugin[FinishShellData]):
5358
- upload-logs.sh || true
5459
- rm -rf /tmp/temporary-files
5560
56-
Use the 'order' attribute to select in which order finishing tasks
57-
should happen if there are multiple configs. Default order is '50'.
61+
Use the :ref:`/spec/core/order` attribute to select in which order
62+
finishing tasks should happen if there are multiple configs. Default
63+
order is ``50``.
5864
"""
5965

6066
_data_class = FinishShellData

0 commit comments

Comments
 (0)