When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.
Overview of the Issue
When using the vagrant post-processer on boxes built through parrallel builds there is no real {{.ArtifactId}} for boxes built with the virtualbox plugin but there is for boxes built with the vmware plugin.
For virtualbox builds the {{.ArtifactId}} is not present in the manifest.
For vmware builds the {{.ArtifactId}} is the vm_name.
Why is this an issue?
Vagrant post-processor defaults to using {{.BuildName}} in output, {{.BuildName}} ends up being the top level template, "virtualbox-iso.default" or "vmware-iso.default" in this case, a unique output name is required to run multiple builds through the Vagrant post-processor without overwriting the previous.
Reproduction Steps
With Simplified Packer Template
For packer build -only=roles.virtualbox-iso.1 .
artifact_id is VM in the manifest
output/packer-manifest.json
...
"artifact_id": "VM",
...
Vagrant outputs box to "output/VM.box"
For packer build -only=roles.vmware-iso.1 .
the artifact_id is the vm_name in the manifest
output/packer-manifest.json
...
"artifact_id": "vmware-box1",
...
Vagrant outputs box to "output/vmware-box1.box"
{{.ArtifactId} should reflect the vm_name as the vmware plugin does so this can be used to uniquely name outputted boxes.
Packer version
Packer v1.8.3
packer-plugin-virtualbox_v1.0.4_x5.0_darwin_amd64
packer-plugin-vmware_v1.0.7_x5.0_darwin_amd64
Simplified Packer Template
Attempted to simplify as much as possible.
source "virtualbox-iso" "default" {
cpus = "${var.cpus}"
disk_size = "${var.disk_size}"
memory = "${var.memory}"
"{{ Other Common Parameters }}"
}
source "vmware-iso" "default" {
cpus = "${var.cpus}"
disk_size = "${var.disk_size}"
memory = "${var.memory}"
"{{ Other Common Parameters }}"
}
build {
name = "roles"
source "virtualbox-iso.1" {
vm_name: virtualbox-box1
"{{ VirtualBox-1 Specific Parameters }}"
}
source "virtualbox-iso.2" {
vm_name: virtualbox-box2
"{{ VirtualBox-2 Specific Parameters }}"
}
source "vmware-iso.1" {
vm_name: vmware-box1
"{{ VMWare-1 Specific Parameters }}"
}
source "vmware-iso.2" {
vm_name: vmware-box2
"{{ VMWare-2 Specific Parameters }}"
}
post-processor "manifest" {
}
post-processor "vagrant" {
output = "output/{{.ArtifactId}}.box"
}
}
Operating system and Environment details
MacOS Monterey Version 12.5 (Intel Processor)
Log Fragments and crash.log files
N/A
When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.
Overview of the Issue
When using the vagrant post-processer on boxes built through parrallel builds there is no real {{.ArtifactId}} for boxes built with the virtualbox plugin but there is for boxes built with the vmware plugin.
For virtualbox builds the {{.ArtifactId}} is not present in the manifest.
For vmware builds the {{.ArtifactId}} is the vm_name.
Why is this an issue?
Vagrant post-processor defaults to using {{.BuildName}} in output, {{.BuildName}} ends up being the top level template, "virtualbox-iso.default" or "vmware-iso.default" in this case, a unique output name is required to run multiple builds through the Vagrant post-processor without overwriting the previous.
Reproduction Steps
With Simplified Packer Template
For
packer build -only=roles.virtualbox-iso.1 .artifact_id is VM in the manifest
output/packer-manifest.json
Vagrant outputs box to "output/VM.box"
For
packer build -only=roles.vmware-iso.1 .the artifact_id is the vm_name in the manifest
output/packer-manifest.json
Vagrant outputs box to "output/vmware-box1.box"
{{.ArtifactId} should reflect the vm_name as the vmware plugin does so this can be used to uniquely name outputted boxes.
Packer version
Packer v1.8.3
packer-plugin-virtualbox_v1.0.4_x5.0_darwin_amd64
packer-plugin-vmware_v1.0.7_x5.0_darwin_amd64
Simplified Packer Template
Attempted to simplify as much as possible.
Operating system and Environment details
MacOS Monterey Version 12.5 (Intel Processor)
Log Fragments and crash.log files
N/A