Skip to content

Commit

Permalink
Merge pull request #121 from lbajolet-hashicorp/makefile_dev_use_pack…
Browse files Browse the repository at this point in the history
…er_install

GNUmakefile: make dev uses packer for install
  • Loading branch information
ethanmdavidson authored Apr 1, 2024
2 parents 6650149 + e395eda commit 158e572
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
NAME=git
BINARY=packer-plugin-${NAME}
PLUGIN_FQN="$(shell grep -E '^module' <go.mod | sed -E 's/module *//')"
HASHICORP_PACKER_PLUGIN_SDK_VERSION?=$(shell go list -m github.com/hashicorp/packer-plugin-sdk | cut -d " " -f2)

COUNT?=1
Expand All @@ -11,9 +12,9 @@ prep: phony
build: phony
@go build -o ${BINARY}

dev: phony build
@mkdir -p ~/.packer.d/plugins/
@mv ${BINARY} ~/.packer.d/plugins/${BINARY}
dev: phony
@go build -ldflags="-X '${PLUGIN_FQN}/version.VersionPrerelease=dev'" -o '${BINARY}'
packer plugins install --path ${BINARY} "$(shell echo "${PLUGIN_FQN}" | sed 's/packer-plugin-//')"

run-example: phony dev
@packer build ./example
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ The typical development flow looks something like this:
6) Once the above steps are complete: commit, push, and open a PR!

For local development, you will need to install:
- [Packer](https://learn.hashicorp.com/tutorials/packer/get-started-install-cli) >= 1.7
- [Packer](https://learn.hashicorp.com/tutorials/packer/get-started-install-cli) >= 1.10.2
- [Go](https://golang.org/doc/install) >= 1.21
- [GNU Make](https://www.gnu.org/software/make/)

Expand Down

0 comments on commit 158e572

Please sign in to comment.