Skip to content

Commit 3e9b602

Browse files
lbajolet-hashicorpnywilken
authored andcommitted
GNUmakefile: make dev uses packer for install
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.
1 parent 2b7a096 commit 3e9b602

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

GNUmakefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
NAME=tencentcloud
22
BINARY=packer-plugin-${NAME}
3+
PLUGIN_FQN="$(shell grep -E '^module' <go.mod | sed -E 's/module *//')"
34

45
COUNT?=1
56
TEST?=$(shell go list ./...)
@@ -10,9 +11,9 @@ HASHICORP_PACKER_PLUGIN_SDK_VERSION?=$(shell go list -m github.com/hashicorp/pac
1011
build:
1112
@go build -o ${BINARY}
1213

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

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

0 commit comments

Comments
 (0)