Skip to content

Commit

Permalink
GNUmakefile: make dev uses packer for install
Browse files Browse the repository at this point in the history
When building the development version of the plugin, we now use
`packer plugins install` for that instead of moving it to the plugins
directory manually.

This target will require Packer 1.10.2 and above to function, as prior
versions don't support instaling pre-release versions of a plugin with
that command.
  • Loading branch information
lbajolet-hashicorp committed Mar 15, 2024
1 parent bb387b2 commit 56ce59e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
NAME=ucloud
BINARY=packer-plugin-${NAME}
PLUGIN_FQN="$(shell grep -E '^module' <go.mod | sed -E 's/module *//')"

COUNT?=1
TEST?=$(shell go list ./...)
Expand All @@ -9,9 +10,9 @@ HASHICORP_PACKER_PLUGIN_SDK_VERSION?=$(shell go list -m github.com/hashicorp/pac
build:
@go build -o ${BINARY}

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

test:
@go test -race -count $(COUNT) $(TEST) -timeout=3m
Expand Down

0 comments on commit 56ce59e

Please sign in to comment.