Plugin development - use plugin built locally

Hi,

I’d like to contribute to GitHub - hashicorp/packer-plugin-proxmox: Packer plugin for Proxmox Builder .
I did some changes and compiled the binary packer-plugin-proxmox.
According to the packer plugin documentation it should be enough to copy this binary to the directory packer is run from (in my case a directory called packer-templates). I did so, but running packer validate . yields:

Error: no plugin installed for github.com/hashicorp/proxmox >= 1.0.6

Did you run packer init for this project ?

If I run packer init . it installs the latest upstream plugin. What do I have to do to use my locally built plugin instead?

Do I have to modify the packer block? It’s currently the default one for the Proxmox plugin:

packer {
  required_plugins {
    proxmox = {
      version = ">= 1.0.6"
      source  = "github.com/hashicorp/proxmox"
    }
  }
}

Regards
Sebastian

OK, so I found packer-plugin-proxmox/CONTRIBUTING.md at main · hashicorp/packer-plugin-proxmox · GitHub (weird that this file is in a hidden folder, but well…).

I ran make dev, which successfully copied the binary to ~/.packer.d/plugins/ and I also removed the packer block in my HCL template file. According to the documentation linked above, this force[s] Packer use the development binary installed in the previous step.

But the local plugin in ~/.packer.d/plugins/ still isn’t picked up.

Running packer with debug logging enabled shows that it finds the external plugin, but loads the internal one anyway:

2022/10/28 20:52:02 [DEBUG] Discovered plugin: proxmox = /home/user/.packer.d/plugins/packer-plugin-proxmox
2022/10/28 20:52:02 [INFO] found external [-packer-default-plugin-name- proxmox-clone proxmox-iso] builders from proxmox plugin
[...]
2022/10/28 20:52:02 [TRACE] Starting internal plugin packer-builder-proxmox-clone
2022/10/28 20:52:02 Starting plugin: /usr/bin/packer []string{"/usr/bin/packer", "plugin", "packer-builder-proxmox-clone"}
Full debug log
PACKER_LOG=1 packer validate .
2022/10/28 20:52:02 [INFO] Packer version: 1.8.3 [go1.17.11 linux amd64]
2022/10/28 20:52:02 Old default config directory found: /home/user/.packer.d
2022/10/28 20:52:02 [TRACE] discovering plugins in /usr/bin
2022/10/28 20:52:02 Old default config directory found: /home/user/.packer.d
2022/10/28 20:52:02 [TRACE] discovering plugins in /home/user/.packer.d/plugins
2022/10/28 20:52:02 [DEBUG] Discovered plugin: proxmox = /home/user/.packer.d/plugins/packer-plugin-proxmox
2022/10/28 20:52:02 [INFO] found external [-packer-default-plugin-name- proxmox-clone proxmox-iso] builders from proxmox plugin
2022/10/28 20:52:02 [TRACE] discovering plugins in .
2022/10/28 20:52:02 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2022/10/28 20:52:02 [INFO] PACKER_CONFIG env var set; attempting to open config file: /home/user/.packerconfig
2022/10/28 20:52:02 [WARN] Config file doesn't exist: /home/user/.packerconfig
2022/10/28 20:52:02 Old default config directory found: /home/user/.packer.d
2022/10/28 20:52:02 [INFO] Setting cache directory: /home/user/.cache/packer
2022/10/28 20:52:02 Old default config directory found: /home/user/.packer.d
2022/10/28 20:52:02 [TRACE] Starting internal plugin packer-builder-proxmox-clone
2022/10/28 20:52:02 Starting plugin: /usr/bin/packer []string{"/usr/bin/packer", "plugin", "packer-builder-proxmox-clone"}
2022/10/28 20:52:02 Waiting for RPC address for: /usr/bin/packer
2022/10/28 20:52:02 packer-builder-proxmox-clone plugin: [INFO] Packer version: 1.8.3 [go1.17.11 linux amd64]
2022/10/28 20:52:02 packer-builder-proxmox-clone plugin: Old default config directory found: /home/user/.packer.d
2022/10/28 20:52:02 packer-builder-proxmox-clone plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2022/10/28 20:52:02 packer-builder-proxmox-clone plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /home/user/.packerconfig
2022/10/28 20:52:02 packer-builder-proxmox-clone plugin: [WARN] Config file doesn't exist: /home/user/.packerconfig
2022/10/28 20:52:02 packer-builder-proxmox-clone plugin: Old default config directory found: /home/user/.packer.d
2022/10/28 20:52:02 packer-builder-proxmox-clone plugin: [INFO] Setting cache directory: /home/user/.cache/packer
2022/10/28 20:52:02 packer-builder-proxmox-clone plugin: args: []string{"packer-builder-proxmox-clone"}
2022/10/28 20:52:02 packer-builder-proxmox-clone plugin: Old default config directory found: /home/user/.packer.d
2022/10/28 20:52:02 packer-builder-proxmox-clone plugin: Plugin address: unix /tmp/packer-plugin2673138119
2022/10/28 20:52:02 packer-builder-proxmox-clone plugin: Waiting for connection...
2022/10/28 20:52:02 Received unix RPC address for /usr/bin/packer: addr is /tmp/packer-plugin2673138119
2022/10/28 20:52:02 packer-builder-proxmox-clone plugin: Serving a plugin connection...
2022/10/28 20:52:02 packer-builder-proxmox-clone plugin: CPU type not set, using default 'kvm64'
2022/10/28 20:52:02 [TRACE] Starting internal plugin packer-provisioner-shell
2022/10/28 20:52:02 Starting plugin: /usr/bin/packer []string{"/usr/bin/packer", "plugin", "packer-provisioner-shell"}
2022/10/28 20:52:02 Waiting for RPC address for: /usr/bin/packer
2022/10/28 20:52:02 packer-provisioner-shell plugin: [INFO] Packer version: 1.8.3 [go1.17.11 linux amd64]
2022/10/28 20:52:02 packer-provisioner-shell plugin: Old default config directory found: /home/user/.packer.d
2022/10/28 20:52:02 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2022/10/28 20:52:02 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /home/user/.packerconfig
2022/10/28 20:52:02 packer-provisioner-shell plugin: [WARN] Config file doesn't exist: /home/user/.packerconfig
2022/10/28 20:52:02 packer-provisioner-shell plugin: Old default config directory found: /home/user/.packer.d
2022/10/28 20:52:02 packer-provisioner-shell plugin: [INFO] Setting cache directory: /home/user/.cache/packer
2022/10/28 20:52:02 packer-provisioner-shell plugin: args: []string{"packer-provisioner-shell"}
2022/10/28 20:52:02 packer-provisioner-shell plugin: Old default config directory found: /home/user/.packer.d
2022/10/28 20:52:02 packer-provisioner-shell plugin: Plugin address: unix /tmp/packer-plugin78735565
2022/10/28 20:52:02 packer-provisioner-shell plugin: Waiting for connection...
2022/10/28 20:52:02 Received unix RPC address for /usr/bin/packer: addr is /tmp/packer-plugin78735565
2022/10/28 20:52:02 packer-provisioner-shell plugin: Serving a plugin connection...
The configuration is valid.
2022/10/28 20:52:02 [INFO] (telemetry) Finalizing.
2022/10/28 20:52:03 waiting for all plugin processes to complete...
2022/10/28 20:52:03 /usr/bin/packer: plugin process exited
2022/10/28 20:52:03 /usr/bin/packer: plugin process exited

This seems to be an issue with the proxmox plugin: Plugin won't load when installed as external plugin · Issue #119 · hashicorp/packer-plugin-proxmox · GitHub

As a workaround I can use proxmox-proxmox-clone and proxmox-proxmox-iso as builder names in my templates until this is fixed.