Skip to content

Commit

Permalink
Validate plugin from the packer-sdc plugin-validate command (#45)
Browse files Browse the repository at this point in the history
* install packer-sdc at the version from deps

* go get github.com/hashicorp/packer-plugin-sdk@v0.2.8

* goreleaser: run plugin-check before release
  • Loading branch information
azr authored Nov 12, 2021
1 parent 20a3b88 commit 922a7d2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ before:
# As part of the release doc files are included as a separate deliverable for
# consumption by Packer.io. To include a separate docs.zip uncomment the following command.
- make ci-release-docs
# Check plugin compatibility with required version of the Packer SDK
- make plugin-check
builds:
# A separated build to run the packer-plugins-check only once for a linux_amd64 binary
-
Expand Down
32 changes: 18 additions & 14 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
NAME=osc
NAME=outscale
BINARY=packer-plugin-${NAME}

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

.PHONY: dev

build:
@go build -o ${BINARY}

generate:
@go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@latest
@go generate -v ./...

ci-release-docs:
@go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@latest
@packer-sdc renderdocs -src docs -partials docs-partials/ -dst docs/
@/bin/sh -c "[ -d docs ] && zip -r docs.zip docs/"

dev: build
@mkdir -p ~/.packer.d/plugins/
@mv ${BINARY} ~/.packer.d/plugins/${BINARY}

run-example: dev
@packer build ./example

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

install-packer-sdc: ## Install packer sofware development command
@go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@${HASHICORP_PACKER_PLUGIN_SDK_VERSION}

ci-release-docs: install-packer-sdc
@packer-sdc renderdocs -src docs -partials docs-partials/ -dst docs/
@/bin/sh -c "[ -d docs ] && zip -r docs.zip docs/"

plugin-check: install-packer-sdc build
@packer-sdc plugin-check ${BINARY}

testacc: dev
@PACKER_ACC=1 go test -count $(COUNT) -v $(TEST) -timeout=120m

generate: install-packer-sdc
@go generate ./...
packer-sdc renderdocs -src ./docs -dst ./.docs -partials ./docs-partials
# checkout the .docs folder for a preview of the docs
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/aws/aws-sdk-go v1.40.54
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/hcl/v2 v2.10.1
github.com/hashicorp/packer-plugin-sdk v0.2.7
github.com/hashicorp/packer-plugin-sdk v0.2.8
github.com/outscale/osc-sdk-go v1.11.2
github.com/zclconf/go-cty v1.9.1
golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ github.com/hashicorp/memberlist v0.2.2 h1:5+RffWKwqJ71YPu9mWsF7ZOscZmwfasdA8kbdC
github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
github.com/hashicorp/packer-plugin-sdk v0.2.7 h1:L7mfLg+gGnqN3z8vEG4YojVsbhYJrNcimvOSIuCN6qA=
github.com/hashicorp/packer-plugin-sdk v0.2.7/go.mod h1:ii9ub5UNAp30RGod3i3W8qj7wA+H7kpURnD+Jt7oDkQ=
github.com/hashicorp/packer-plugin-sdk v0.2.8 h1:743RCKQmpiiCo4R+Xs0fO1fMNkpi4VdGfX0tZ6aNdUg=
github.com/hashicorp/packer-plugin-sdk v0.2.8/go.mod h1:ii9ub5UNAp30RGod3i3W8qj7wA+H7kpURnD+Jt7oDkQ=
github.com/hashicorp/serf v0.9.5 h1:EBWvyu9tcRszt3Bxp3KNssBMP1KuHWyO51lz9+786iM=
github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk=
github.com/hashicorp/vault/api v1.0.5-0.20200519221902-385fac77e20f/go.mod h1:euTFbi2YJgwcju3imEt919lhJKF68nN1cQPq3aA+kBE=
Expand Down

0 comments on commit 922a7d2

Please sign in to comment.