hashicorp / packer-plugin-vsphere

Packer plugin for VMware vSphere Builder
https://www.packer.io/docs/builders/vsphere
Mozilla Public License 2.0
93 stars 91 forks source link

feat: add support for export to ova #409

Closed tenthirtyam closed 2 months ago

tenthirtyam commented 2 months ago

Summary

Adds support to export a virtual machine image to either to the default Open Virtualization Format (ovf) or convert to Open Virtualization Archive (.ova).

[!NOTE] To use the ova format option, VMware ovftool must be installed on the Packer host and accessible in either the system PATH or the user's PATH. This is noted in the documentation.

Testing

Standard Build and Tests:

➜  packer-plugin-vsphere git:(feat/export-to-ova) ✗ make generate
2024/04/18 15:30:19 Copying "docs" to ".docs/"
2024/04/18 15:30:19 Replacing @include '...' calls in .docs/
Compiling MDX docs in '.docs' to Markdown in '.web-docs'...

➜  packer-plugin-vsphere git:(feat/export-to-ova) make build

➜  packer-plugin-vsphere git:(feat/export-to-ova) make test
?       github.com/hashicorp/packer-plugin-vsphere      [no test files]
?       github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/common/testing       [no test files]
?       github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/examples/driver      [no test files]
ok      github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/clone        2.655s
ok      github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/common       4.941s
?       github.com/hashicorp/packer-plugin-vsphere/version      [no test files]
ok      github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/driver       11.917s
ok      github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/iso  5.328s
ok      github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/supervisor   8.156s
ok      github.com/hashicorp/packer-plugin-vsphere/post-processor/vsphere       2.179s
ok      github.com/hashicorp/packer-plugin-vsphere/post-processor/vsphere-template      3.547s

Additional Tests

✅ PASS: Export without setting Format. Defaults to ovf. ✅ PASS: Export without setting Format. Defaults to ovf. Expected error for existing ovf file found. ✅ PASS: Export without setting Format with force = true. Defaults to ovf. Existing ovf overwritten. ✅ PASS: Export setting Format to ova without ovftool installed or in PATH. Expected error. ✅ PASS: Export setting Format to ova. ✅ PASS: Export setting Format to ova. Expected error for existing ova file found and intermediate files removed. ✅ PASS: Export setting Format to ova with force = true. Existing ova overwritten and intermediate files removed.

Reference

Closes #17

VMware Open Virtualization Format Tool (ovftool).

tenthirtyam commented 2 months ago

Comments addressed in 97a2527. Running another round of tests to ensure all is still well.