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

Packer init fails on packer 1.10 #1379

Open
batinicaz opened this issue Dec 16, 2023 · 0 comments · May be fixed by #1380
Open

Packer init fails on packer 1.10 #1379

batinicaz opened this issue Dec 16, 2023 · 0 comments · May be fixed by #1380
Labels
bug Something isn't working

Comments

@batinicaz
Copy link

batinicaz commented Dec 16, 2023

Describe the bug

Packer 1.10 has changed the output of the packer -version command: hashicorp/packer#12569

This change means that instead of the packer -version command just returning a version number e.g. 1.9.4 it now returns something like Packer v1.10.0.

Terratest is performing a version check to see if packer init is available, it directly constructs the version of packer from this command output: https://github.com/gruntwork-io/terratest/blob/v0.46.8/modules/packer/packer.go#L189-L193

This results in the hashicorp/go-version module throwing an error when packer 1.10 is used due to the new version output:

Malformed version: Packer v1.10.0

To Reproduce
Run the packer hello world test using v1.10.0: go test -v packer_hello_world_example_test.go

Example output from test on v1.10.0:

$ go test -v packer_hello_world_example_test.go
=== RUN   TestPackerHelloWorldExample
TestPackerHelloWorldExample 2023-12-16T09:04:27Z logger.go:66: Running Packer to generate a custom artifact for template ../examples/packer-hello-world-example/build.pkr.hcl
TestPackerHelloWorldExample 2023-12-16T09:04:27Z logger.go:66: Creating a temporary directory for Packer plugins
TestPackerHelloWorldExample 2023-12-16T09:04:27Z logger.go:66: Running command packer with args [-version]
TestPackerHelloWorldExample 2023-12-16T09:04:27Z logger.go:66: Packer v1.10.0
    packer.go:91: Malformed version: Packer v1.10.0
--- FAIL: TestPackerHelloWorldExample (5.47s)
FAIL
FAIL    command-line-arguments  5.813s
FAIL

Expected behavior
Terratests packer init on packer v1.10.0 works as it did previously, without failing on the version number structure.

Versions

  • Terratest version: v0.46.8
  • Environment details (Ubuntu 20.04, Windows 10, etc.): MacOS 14.2
@batinicaz batinicaz added the bug Something isn't working label Dec 16, 2023
@batinicaz batinicaz linked a pull request Dec 16, 2023 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant