hashicorp / hashicorp/packer-plugin-virtualbox

{{.ArtifactId}} is not defined in parallel build

Open
#78 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Go
Stars
29
Forks
45
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.