Skip to content
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

packer init creates plugins in homebrew directory. #12574

Closed
madelaney opened this issue Aug 15, 2023 · 2 comments
Closed

packer init creates plugins in homebrew directory. #12574

madelaney opened this issue Aug 15, 2023 · 2 comments
Labels

Comments

@madelaney
Copy link

madelaney commented Aug 15, 2023

Community Note

  • Please vote on this issue by adding a 👍 reaction 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

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

With packer (v1.9.2) on Apple Mac M1 chip, when I run packer init, I'd expected the plugins to get installed in $HOME/.config/packer/plugins but they're getting installed in /opt/homebrew/bin/github.com/hashicorp/....

Reproduction Steps

  1. Create simple packer with Azure ARM builder.
  2. Ensure we have the following block:
packer {
  required_plugins {
    azure = {
      source  = "github.com/hashicorp/azure"
      version = "~> 1"
    }
  }
}
  1. Run packer init

Packer version

1.9.2 (installed via homebrew)

Simplified Packer Template

packer {
  required_plugins {
    azure = {
      source  = "github.com/hashicorp/azure"
      version = "~> 1"
    }
  }
}

source "azure-arm" "default" {
.. add builder info here.
}

Operating system and Environment details

Mac OS X (13.5), Apple M1 chip.

Log Fragments and crash.log files

2023/08/15 12:28:34 [INFO] Packer version: 1.9.2 [go1.20.6 darwin arm64]
2023/08/15 12:28:34 [TRACE] discovering plugins in 
2023/08/15 12:28:34 [TRACE] discovering plugins in /opt/homebrew/bin
2023/08/15 12:28:34 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2023/08/15 12:28:34 [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/mdelaney/.packerconfig
2023/08/15 12:28:34 [WARN] Config file doesn't exist: /Users/mdelaney/.packerconfig
2023/08/15 12:28:34 [INFO] Setting cache directory: /Users/mdelaney/.cache/packer
2023/08/15 12:28:34 [TRACE] init: plugingetter.ListInstallationsOptions{FromFolders:[]string{"", "/opt/homebrew/bin"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"darwin", ARCH:"arm64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0x140005ca680)}}}}
2023/08/15 12:28:34 [TRACE] listing potential installations for "github.com/hashicorp/azure" that match "~> 1". plugingetter.ListInstallationsOptions{FromFolders:[]string{"", "/opt/homebrew/bin"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"darwin", ARCH:"arm64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0x140005ca680)}}}}
2023/08/15 12:28:34 [TRACE] for plugin github.com/hashicorp/azure found 0 matching installation(s)
2023/08/15 12:28:34 [TRACE] getting available versions for the github.com/hashicorp/azure plugin
2023/08/15 12:28:34 [WARNING] github-getter: no GitHub token set, if you intend to install plugins often, please set the PACKER_GITHUB_API_TOKEN env var
2023/08/15 12:28:34 [DEBUG] github-getter: getting "https://api.github.com/repos/hashicorp/packer-plugin-azure/git/matching-refs/tags"
2023/08/15 12:28:34 [DEBUG] will try to install: [2.0.0 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.1 1.3.0 1.2.0 1.1.0 1.0.8 1.0.7 1.0.6 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 1.0.0]
2023/08/15 12:28:34 [TRACE] fetching checksums file for the "2.0.0" version of the github.com/hashicorp/azure plugin in "/opt/homebrew/bin/github.com/hashicorp/azure"...
2023/08/15 12:28:34 [DEBUG] github-getter: getting "https://github.com/hashicorp/packer-plugin-azure/releases/download/v2.0.0/packer-plugin-azure_v2.0.0_SHA256SUMS"
2023/08/15 12:28:34 [TRACE] ignoring invalid remote binary packer-plugin-azure_v2.0.0_x5.0_openbsd_arm.zip: wrong system, expected darwin_arm64 
2023/08/15 12:28:34 [TRACE] ignoring invalid remote binary packer-plugin-azure_v2.0.0_x5.0_freebsd_amd64.zip: wrong system, expected darwin_arm64 
2023/08/15 12:28:34 [TRACE] ignoring invalid remote binary packer-plugin-azure_v2.0.0_x5.0_netbsd_386.zip: wrong system, expected darwin_arm64 
2023/08/15 12:28:34 [TRACE] ignoring invalid remote binary packer-plugin-azure_v2.0.0_x5.0_solaris_amd64.zip: wrong system, expected darwin_arm64 
2023/08/15 12:28:34 [TRACE] ignoring invalid remote binary packer-plugin-azure_v2.0.0_x5.0_freebsd_386.zip: wrong system, expected darwin_arm64 
2023/08/15 12:28:34 [TRACE] ignoring invalid remote binary packer-plugin-azure_v2.0.0_x5.0_windows_386.zip: wrong system, expected darwin_arm64 
2023/08/15 12:28:34 [TRACE] ignoring invalid remote binary packer-plugin-azure_v2.0.0_x5.0_darwin_amd64.zip: wrong system, expected darwin_arm64 
2023/08/15 12:28:34 [TRACE] ignoring invalid remote binary packer-plugin-azure_v2.0.0_x5.0_linux_arm64.zip: wrong system, expected darwin_arm64 
2023/08/15 12:28:34 [TRACE] ignoring invalid remote binary packer-plugin-azure_v2.0.0_x5.0_freebsd_arm.zip: wrong system, expected darwin_arm64 
2023/08/15 12:28:34 [TRACE] ignoring invalid remote binary packer-plugin-azure_v2.0.0_x5.0_openbsd_386.zip: wrong system, expected darwin_arm64 
2023/08/15 12:28:34 [TRACE] ignoring invalid remote binary packer-plugin-azure_v2.0.0_x5.0_windows_amd64.zip: wrong system, expected darwin_arm64 
2023/08/15 12:28:34 [TRACE] ignoring invalid remote binary packer-plugin-azure_v2.0.0_x5.0_linux_386.zip: wrong system, expected darwin_arm64 
2023/08/15 12:28:34 [TRACE] ignoring invalid remote binary packer-plugin-azure_v2.0.0_x5.0_openbsd_amd64.zip: wrong system, expected darwin_arm64 
2023/08/15 12:28:34 [TRACE] ignoring invalid remote binary packer-plugin-azure_v2.0.0_x5.0_linux_amd64.zip: wrong system, expected darwin_arm64 
2023/08/15 12:28:34 [TRACE] ignoring invalid remote binary packer-plugin-azure_v2.0.0_x5.0_netbsd_arm.zip: wrong system, expected darwin_arm64 
2023/08/15 12:28:34 [TRACE] ignoring invalid remote binary packer-plugin-azure_v2.0.0_x5.0_netbsd_amd64.zip: wrong system, expected darwin_arm64 
2023/08/15 12:28:34 [TRACE] ignoring invalid remote binary packer-plugin-azure_v2.0.0_x5.0_linux_arm.zip: wrong system, expected darwin_arm64 
2023/08/15 12:28:34 [TRACE] About to get: packer-plugin-azure_v2.0.0_x5.0_darwin_arm64.zip
2023/08/15 12:28:34 [DEBUG] github-getter: getting "https://github.com/hashicorp/packer-plugin-azure/releases/download/v2.0.0/packer-plugin-azure_v2.0.0_x5.0_darwin_arm64.zip"
2023/08/15 12:28:36 [INFO] (telemetry) Finalizing.
�[1;36mInstalled plugin github.com/hashicorp/azure v2.0.0 in "/opt/homebrew/bin/github.com/hashicorp/azure/packer-plugin-azure_v2.0.0_x5.0_darwin_arm64"�[0m
2023/08/15 12:28:36 waiting for all plugin processes to complete...

@madelaney madelaney added the bug label Aug 15, 2023
@madelaney
Copy link
Author

Nevermind, this is a side effect of the Homebrew install. I'll close this out.

For context, homebrew will put packer in the path but it's not a symlink or copy of packer proper but instead it is a shell script that sets/appends PACKER_PLUGIN_PATH then invokes packer proper.

The script, as of today, looks something like:

#!/bin/bash
PACKER_PLUGIN_PATH="$PACKER_PLUGIN_PATH:/opt/homebrew/bin" exec "/opt/homebrew/Cellar/packer/1.9.2/libexec/bin/packer"  "$@"

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant