-
Notifications
You must be signed in to change notification settings - Fork 13
Convert Packer definition to HCL2 #501
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
Conversation
9a41168
to
5922cfc
Compare
Hmm... Looks like something goes wrong either during the Ubuntu |
bec56a1
to
cba6d51
Compare
@ripleymj If you're opposed to enabling EFI, I can try to debug the second commit on this PR a bit more... but also might be fun to just see what happens? |
cba6d51
to
4f36955
Compare
It looks like the Ubuntu file never got updated for 22.04, and the corresponding grub syntax change. I think you've got the right syntax now, especially |
Okay. Let me try just dropping the EFI change then. For some reason it felt like I got a slightly different flow with BIOS but let's find out! |
4f36955
to
129b377
Compare
u right. EFI removed (for now) |
12bb915
to
7a67fd0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I've done my best here to also reduce some code duplication; it makes less-than-perfectly clean code in a few places but:
- we just try both
initrd
andinitrd.lz
as paths for the initrd; grub ignores the wrong one - we use
|| true
to a systemctl command so that we can use the same script to stopapt
and run theoem-build
script
The mint_info
and ubuntu_info
blocks in locals
also aren't the mostly lovely thing in the world. But on the whole, this significantly reduces the duplication that we had before and makes these a little easier to manage going forward hopefully.
I wish there was a good way to merge
the export_opts
so that we only had to specify the different values but I don't see a phenomenal option (and again, we were duplicating it before anyway).
Unless I find some sort of issue with this during testing, I think that for the most part I am done making changes here and this is actually ready for review.
Before I try to understand this, any thoughts on how AARCH64 from #457 will merge in? Is qemu too far away to merge with VirtualBox? |
Yeah, so it'd definitely need a different top-level https://github.com/hashicorp/packer/tree/main/examples/hcl/linux is the directory on the |
7a67fd0
to
17e0787
Compare
A warning to anyone else who might test this, the Mint beta vars are required at the moment after the |
a228401
to
d06a6b4
Compare
This rewrites the packer JSON files to use the HCL2 language support added in 1.5 and stabilized in 1.7. The initial conversion was performed using the `hcl2_upgrade` command but quite a lot of custom work has been done on top of that. A base shared definition for the VM is created that defines all the shared options (CPU, memory, SSH stuff, etc) and then that is specialized in the `build` block for each `source`, this is where the differences between Ubuntu and Mint are specified. Additionally, we now store version information as complex objects that meet our needs a bit more closely. This is required because some of the interpolation that we did in JSON is no longer available. As I was reviewing the VirtualBox builder config I also moved a few things from manual `VBoxManage` commands to actual packer definitions but some of those could have been done in the JSON format as well.
d06a6b4
to
fefa96e
Compare
This rewrites the packer JSON files to use the HCL2 language support
added in 1.5 and stabilized in 1.7. The initial conversion was performed
using the
hcl2_upgrade
command but quite a lot of custom work has beendone on top of that.
A base shared definition for the VM is created that defines all the
shared options (CPU, memory, SSH stuff, etc) and then that is
specialized in the
build
block for eachsource
, this is where thedifferences between Ubuntu and Mint are specified.
Additionally, we now store version information as complex objects that
meet our needs a bit more closely. This is required because some of the
interpolation that we did in JSON is no longer available.
As I was reviewing the VirtualBox builder config I also moved a few
things from manual
VBoxManage
commands to actual packer definitionsbut some of those could have been done in the JSON format as well.
Closes #460