Unable to get a manually installed plugin to load
- Dominant language
- Go
- Stars
- 15.8k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
#### Community Note
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment
#### Overview of the Issue
We are unable to make a manually-installed plugin work. Our scenario is that we have a custom version of the OpenStack plugin, which we want to test alongside the stock Ansible plugin specified in the `packer` block:
```
packer {
required_plugins {
ansible = {
source = "github.com/hashicorp/ansible"
version = "~> 1"
}
}
}
```
Our custom build of the OpenStack plugin is installed in the same directory (`/usr/local/bin`) as the Packer binary itself. According to the trace, the plugin is "discovered" but then an error is produced that the file just found doesn't exist, a configuration error.
What we've tried to fix this:
- Various plugin binary permissions: `0777`, `0755`
- Various plugin binary owners: `root` (to match the Packer binary), `ci-pipeline-build` (the user executing Packer)
- Various naming for the plugin: `packer-plugin-openstack`, `packer-plugin-openstack_v1.1.1_x5.0_linux_amd64`
- Various locations for the plugin: `/usr/local/bin`; `/home/ci-pipeline-builder/.config/packer/plugins/`; `/home/ci-pipeline-builder/.config/packer/plugins/github.com/hashicorp/openstack/`
#### Reproduction Steps
Clone plugin repo:
```
git clone https://github.com/hashicorp/packer-plugin-openstack.git
```
Build repo:
```
go build
```
Copy built binary to directory where Packer binary lives:
```
cp packer-plugin-openstack /usr/local/bin/
chmod 0777 packer-plugin-openstack
chown root:root packer-plugin-openstack
```
Execute Packer build:
```
# Packer v1.9.4 requires init to fetch plugins
export PR_CFG="packer-runner.pkr.hcl"
PACKER_PLUGIN_PATH="/usr/local/bin" PACKER_LOG=1 packer init "${PR_CFG}"
PACKER_PLUGIN_PATH="/usr/local/bin" PACKER_LOG=1 packer plugins installed
PACKER_PLUGIN_PATH="/usr/local/bin" PACKER_LOG=1 packer validate "${PR_CFG}"
PACKER_PLUGIN_PATH="/usr/local/bin" PACKER_LOG=1 packer build "${PR_CFG}"
```
### Packer version
v1.9.4
### Simplified Packer Template
TBC
### Operating system and Environment details
Executing in a GitLab runner Docker container
Alpine Linux: `alpine:3.15.4`
### Log Fragments and crash.log files
Note in the following there's no output from the `packer plugins installed` command, so it seems the `init` must be failing?
```
2023/12/06 15:53:54 [INFO] Packer version: 1.9.4 [go1.20.7 linux amd64]
2023/12/06 15:53:54 [TRACE] discovering plugins in /usr/local/bin
2023/12/06 15:53:54 [INFO] Discovered potential plugin: openstack = /usr/local/bin/packer-plugin-openstack
Error loading configuration:
fork/exec /usr/local/bin/packer-plugin-openstack: no such file or directory
```
At that point the runner process fails and cleans up.
Contributor guide
Research direction
Start with the packer-plugin-openstack repository and reproduce the reported `go build`, copy, `packer init`, and `packer plugins installed` commands on Alpine Linux. Compare plugin discovery in `/usr/local/bin` with the subsequent `fork/exec ... no such file or directory` error; done means the manually built OpenStack plugin loads successfully alongside the configured Ansible plugin.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100