Skip to content

Commit d45b4b7

Browse files
author
Wilken Rivera
authored
Merge pull request #46 from hashicorp/azr/validate-plugin-with-packer-sdk
Validate plugin from the packer-sdc plugin-validate command
2 parents b1b9980 + aa52a45 commit d45b4b7

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

.goreleaser.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,13 @@ before:
1010
# As part of the release doc files are included as a separate deliverable for
1111
# consumption by Packer.io. To include a separate docs.zip uncomment the following command.
1212
- make ci-release-docs
13+
# Check plugin compatibility with required version of the Packer SDK
14+
- make plugin-check
1315
builds:
1416
# A separated build to run the packer-plugins-check only once for a linux_amd64 binary
1517
-
1618
id: plugin-check
1719
mod_timestamp: '{{ .CommitTimestamp }}'
18-
hooks:
19-
post:
20-
# This will check plugin compatibility against latest version of Packer
21-
- cmd: |
22-
go install github.com/hashicorp/packer/cmd/packer-plugins-check@latest &&
23-
packer-plugins-check -load={{ .Name }}
24-
dir: "{{ dir .Path}}"
2520
flags:
2621
- -trimpath #removes all file system paths from the compiled executable
2722
ldflags:

GNUmakefile

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ BINARY=packer-plugin-${NAME}
33

44
COUNT?=1
55
TEST?=$(shell go list ./...)
6+
HASHICORP_PACKER_PLUGIN_SDK_VERSION?=$(shell go list -m github.com/hashicorp/packer-plugin-sdk | cut -d " " -f2)
67

78
.PHONY: dev
89

@@ -13,21 +14,23 @@ dev: build
1314
@mkdir -p ~/.packer.d/plugins/
1415
@mv ${BINARY} ~/.packer.d/plugins/${BINARY}
1516

16-
run-example: dev
17-
@packer build ./example
17+
test:
18+
@go test -race -count $(COUNT) $(TEST) -timeout=3m
1819

19-
install-gen-deps: ## Install dependencies for code generation
20-
@go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@latest
20+
install-packer-sdc: ## Install packer sofware development command
21+
@go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@${HASHICORP_PACKER_PLUGIN_SDK_VERSION}
2122

22-
ci-release-docs: install-gen-deps
23+
ci-release-docs: install-packer-sdc
2324
@packer-sdc renderdocs -src docs -partials docs-partials/ -dst docs/
2425
@/bin/sh -c "[ -d docs ] && zip -r docs.zip docs/"
2526

26-
test:
27-
@go test -count $(COUNT) $(TEST) -timeout=3m
28-
29-
generate: install-gen-deps
30-
go generate ./...
27+
plugin-check: install-packer-sdc build
28+
@packer-sdc plugin-check ${BINARY}
3129

3230
testacc: dev
3331
@PACKER_ACC=1 go test -count $(COUNT) -v $(TEST) -timeout=120m
32+
33+
generate: install-packer-sdc
34+
@go generate ./...
35+
packer-sdc renderdocs -src ./docs -dst ./.docs -partials ./docs-partials
36+
# checkout the .docs folder for a preview of the docs

0 commit comments

Comments
 (0)