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: check ovftool version #201

Merged
merged 1 commit into from
Aug 8, 2024
Merged

Conversation

tenthirtyam
Copy link
Collaborator

@tenthirtyam tenthirtyam commented Jun 25, 2024

Description

Checks the minimum recommended version of VMware Open Virtualization Format Tool ('ovftool').

Sets the minimum recommended to 4.6.0 to support vSphere 8.0 and earlier.

Also improves the documentation for Export Configuration that uses ovftool.

Testing

✅ Basic Tests

packer-plugin-vmware on  feat/check-ovftool-version
✦ ➜ go fmt ./...

packer-plugin-vmware on  feat/check-ovftool-version
✦ ➜ make generate
2024/08/08 18:43:42 Copying "docs" to ".docs/"
2024/08/08 18:43:42 Replacing @include '...' calls in .docs/
Compiling MDX docs in '.docs' to Markdown in '.web-docs'...

packer-plugin-vmware on  feat/check-ovftool-version
✦ ➜ make build

packer-plugin-vmware on  feat/check-ovftool-version
✦ ➜ make test
?       github.com/hashicorp/packer-plugin-vmware       [no test files]
?       github.com/hashicorp/packer-plugin-vmware/version       [no test files]
ok      github.com/hashicorp/packer-plugin-vmware/builder/vmware/common 7.199s
ok      github.com/hashicorp/packer-plugin-vmware/builder/vmware/iso    3.096s
ok      github.com/hashicorp/packer-plugin-vmware/builder/vmware/vmx    4.169s

✅ Unit Tests

  1. OVFTool not installed.
✦4 ➜ PACKER_LOG=1 PACKER_LOG_PATH=packer.log packer build --force -var-file=photon-4.0-R2.pkrvars.hcl .
vmware-iso.vagrant-vmw: output will be in this color.

Build 'vmware-iso.vagrant-vmw' errored after 179 milliseconds 114 microseconds: ovftool not found; install and include it in your PATH

==> Wait completed after 179 milliseconds 223 microseconds

==> Some builds didn't complete successfully and had errors:
--> vmware-iso.vagrant-vmw: ovftool not found; install and include it in your PATH
  1. OVFTool < 4.6.0
2024/08/08 18:40:36 packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_amd64 plugin: 2024/08/08 18:40:36 Verifying that ovftool exists...
2024/08/08 18:40:36 packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_amd64 plugin: 2024/08/08 18:40:36 Checking ovftool version...
2024/08/08 18:40:38 packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_amd64 plugin: 2024/08/08 18:40:38 Returned ovftool version: VMware ovftool 4.5.0 (build-20459872)
2024/08/08 18:40:38 packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_amd64 plugin: .
2024/08/08 18:40:38 packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_amd64 plugin: 2024/08/08 18:40:38 [WARN] The version of ovftool (4.5.0) is below the minimum recommended version (4.6.0). Please download the latest version from https://developer.broadcom.com/tools/open-virtualization-format-ovf-tool/latest.
  1. OVFTool >= 4.6.0
2024/08/08 18:42:21 packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_amd64 plugin: 2024/08/08 18:42:21 Verifying that ovftool exists...
2024/08/08 18:42:21 packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_amd64 plugin: 2024/08/08 18:42:21 Checking ovftool version...
2024/08/08 18:42:23 packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_amd64 plugin: 2024/08/08 18:42:23 Returned ovftool version: VMware ovftool 4.6.3 (build-24031167)
2024/08/08 18:42:23 packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_amd64 plugin: .
2024/08/08 18:42:23 ui: �[1;32m==> vmware-iso.vagrant-vmw: Retrieving ISO�[0m

Reference

Closes #135

@tenthirtyam tenthirtyam added documentation Improvements or additions to documentation enhancement labels Jun 25, 2024
@tenthirtyam tenthirtyam added this to the v1.0.12 milestone Jun 25, 2024
@tenthirtyam tenthirtyam requested a review from nywilken June 25, 2024 23:41
@tenthirtyam tenthirtyam requested a review from a team as a code owner June 25, 2024 23:41
@tenthirtyam tenthirtyam force-pushed the feat/check-ovftool-version branch from e2599bb to 843025f Compare June 25, 2024 23:58
@tenthirtyam tenthirtyam self-assigned this Jun 25, 2024
@tenthirtyam tenthirtyam force-pushed the feat/check-ovftool-version branch from 843025f to dabfdf6 Compare June 29, 2024 02:58
@nywilken
Copy link
Contributor

nywilken commented Jul 1, 2024

I don't enough about this change yet. But the fact that we are not enforcing a minimum version feels like it will break user workflows. Should this be a minor bump instead?

@tenthirtyam
Copy link
Collaborator Author

A minor bump would make sense, yes.
There is a related issue from the Terraform provider history i can link.

@tenthirtyam tenthirtyam force-pushed the feat/check-ovftool-version branch from dabfdf6 to 76fe0fc Compare July 24, 2024 17:33
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.

Thanks for the reroll @tenthirtyam!

Looking at the CheckOVFToolVersion function, I think we can iterate on it a bit more to make it more robust/simple, but aside from those comments, the code looks good!

I'll come back for another round of review when you've had a chance to address my comments.

builder/vmware/common/driver.go Outdated Show resolved Hide resolved
builder/vmware/common/driver.go Outdated Show resolved Hide resolved
builder/vmware/common/driver.go Outdated Show resolved Hide resolved
builder/vmware/common/driver.go Outdated Show resolved Hide resolved
@tenthirtyam tenthirtyam force-pushed the feat/check-ovftool-version branch 3 times, most recently from 939a252 to 082fb4b Compare July 26, 2024 23:42
@tenthirtyam
Copy link
Collaborator Author

I've refactored. Let me know what you think. I still need to run some additional tests prior to a merge and will report back.

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.

Left a couple more suggestions regarding the check function, in the end, given the usage for both the bool and the error, it seems that error alone would make more sense as the two point to the same thing: we cannot proceed as either we couldn't detect the version, or the installed one is too old.

builder/vmware/common/driver.go Outdated Show resolved Hide resolved
builder/vmware/common/driver.go Outdated Show resolved Hide resolved
@tenthirtyam tenthirtyam force-pushed the feat/check-ovftool-version branch 6 times, most recently from 0b49707 to e6aec7a Compare August 6, 2024 21:38
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.

Left a few more suggestions on the code, having a warning regarding the version of OVFTool sounds good to me, we can continue with this approach, no problem here!

builder/vmware/common/driver.go Outdated Show resolved Hide resolved
builder/vmware/common/driver.go Outdated Show resolved Hide resolved
builder/vmware/common/driver.go Outdated Show resolved Hide resolved
Checks the minimum recommended version of VMware Open Virtualization Format Tool ('ovftool').

Ref: #135

Signed-off-by: Ryan Johnson <[email protected]>
@tenthirtyam tenthirtyam force-pushed the feat/check-ovftool-version branch from e6aec7a to 6f50269 Compare August 8, 2024 22:45
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 many rerolls @tenthirtyam, will merge ASAP

@lbajolet-hashicorp lbajolet-hashicorp merged commit f7d9a84 into main Aug 8, 2024
12 checks passed
@lbajolet-hashicorp lbajolet-hashicorp deleted the feat/check-ovftool-version branch August 8, 2024 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vmware-iso: improve documentation when export configuration with format and ovftool_options
3 participants