You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-5Lines changed: 10 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,28 +1,32 @@
1
1
# Packer Plugin Testinfra
2
2
The Packer plugin for [Testinfra](https://testinfra.readthedocs.io) (currently and probably also in the future only the provisioner component implemented) is used with [Packer](https://www.packer.io) for automatically validating Packer-managed custom machine image artifacts against Testinfra tests.
3
3
4
-
## Installation
4
+
## Requirements
5
+
- Packer >= 1.7.0
6
+
- Pytest >= 8.4.0
7
+
- Testinfra >= 6.7.0
5
8
6
-
This plugin requires Packer version `>= 1.7.0` due to the modern SDK usage. A simple Packer config located in the same directory as your other templates and configs utilizing this plugin can automatically manage the plugin:
9
+
## Installation
10
+
A simple Packer config located in the same directory as your other templates and configs utilizing this plugin can automatically manage the plugin:
7
11
8
12
```hcl
9
13
packer {
10
14
required_plugins {
11
15
testinfra = {
12
-
version = "~> 1.5.0"
16
+
version = "~> 1.6.0"
13
17
source = "github.com/mschuchard/testinfra"
14
18
}
15
19
}
16
20
}
17
21
```
18
22
19
-
Afterwards, `packer init` can automatically manage your plugin as per normal. Note that this plugin currently does not manage your local device's Testinfra installation, and you will need to install that on your local device as a prerequisite for this plugin to function correctly (if not executing local to the instance). If you are using this plugin with `local` enabled, then there is some assistance with managing Testinfra on the temporary Packer instance with the `install_cmd` parameter. The minimum supported version of Testinfra is `6.7.0`. The minimum supported version of Pytest is unknown, but it would be recommended to install a version `>= 7.0.0`.
23
+
Afterwards, `packer init` can automatically manage your plugin as per normal. Note that this plugin currently does not manage your local device's Testinfra installation, and you will need to install that on your local device as a prerequisite for this plugin to function correctly (if not executing local to the instance). If you are using this plugin with `local` enabled, then there is some assistance with managing Testinfra on the temporary Packer instance with the `install_cmd` parameter.
20
24
21
25
## Usage
22
26
23
27
### Basic Example
24
28
25
-
A basic example for usage of this plugin with selected optional arguments follows below:
29
+
A basic example for usage of this plugin with randomly selected optional arguments follows below:
26
30
27
31
```hcl
28
32
build {
@@ -42,6 +46,7 @@ build {
42
46
|**chdir**| Change into this directory before executing `pytest`. Unsupported with `local` test execution. | string |`cwd`| no |
43
47
|**compact**| Whether to report in compact form (no header, summary, or warnings). | bool | false | no |
44
48
|**destination_dir**| Whether to transfer the `test_files` to the temporary Packer instance used for building the machine image artifact at input value location. Presence of this directory cannot be validated prior to execution. Ignored unless `local` is `true`. The `file` provisioner should normally be preferred instead of this parameter, and this should also be considered a beta feature. | string | "" | no |
49
+
|**env_vars**| Additional environment variables to be appended to the system environment variables during test execution. These are ignored if `local` is `true`. | map(string) | {} | no |
45
50
|**install_cmd**| Command to execute on the instance used for building the machine image artifact; can be used to e.g. install and configure Testinfra prior to a `local` test execution. Ignored unless `local` is `true`. | list(string) |[]| no |
46
51
|**keyword**| PyTest keyword substring expression for selective test execution. | string | "" | no |
47
52
|**local**| Execute Testinfra tests locally on the instance used for building the machine image artifact. Most plugin validation is skipped with this option. | bool | false | no |
0 commit comments