Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for export to ova #409

Merged
merged 1 commit into from
May 10, 2024
Merged

Conversation

tenthirtyam
Copy link
Collaborator

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 tenthirtyam added enhancement builder/vsphere-iso Builder: vsphere-iso builder/vsphere-clone Builder: vsphere-clone labels Apr 18, 2024
@tenthirtyam tenthirtyam added this to the v1.2.8 milestone Apr 18, 2024
@tenthirtyam tenthirtyam self-assigned this Apr 18, 2024
@tenthirtyam tenthirtyam requested a review from a team as a code owner April 18, 2024 19:48
@tenthirtyam tenthirtyam removed the builder/vsphere-clone Builder: vsphere-clone label Apr 28, 2024
@tenthirtyam tenthirtyam force-pushed the feat/export-to-ova branch 2 times, most recently from d207291 to 24bf114 Compare May 9, 2024 16:16
Copy link
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-approving since overall this looks good to me, just left a couple nits, but we're close to merge imo!

builder/vsphere/common/step_export.go Outdated Show resolved Hide resolved
builder/vsphere/common/step_export.go Outdated Show resolved Hide resolved
builder/vsphere/common/step_export.go Outdated Show resolved Hide resolved
@tenthirtyam tenthirtyam force-pushed the feat/export-to-ova branch from 24bf114 to 97a2527 Compare May 9, 2024 22:27
@tenthirtyam
Copy link
Collaborator Author

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

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.

Signed-off-by: Ryan Johnson <[email protected]>
@tenthirtyam tenthirtyam force-pushed the feat/export-to-ova branch from 97a2527 to 4e2c30b Compare May 9, 2024 22:30
Copy link
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for the rerolls

@lbajolet-hashicorp lbajolet-hashicorp merged commit a03ab4c into main May 10, 2024
12 checks passed
@lbajolet-hashicorp lbajolet-hashicorp deleted the feat/export-to-ova branch May 10, 2024 18:12
@hashicorp hashicorp locked as resolved and limited conversation to collaborators Jun 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vsphere-iso: Add support for exporting to OVA
2 participants