Skip to content

Commit

Permalink
Improve developing plugin documentation (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
wata727 authored Oct 14, 2024
1 parent b66b149 commit 1161515
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/vendor
packer-plugin-amazon-ami-management
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ NAME=amazon-ami-management
BINARY=packer-plugin-${NAME}
MOCK_VERSION?=$(shell go list -m github.com/golang/mock | cut -d " " -f2)
SDK_VERSION?=$(shell go list -m github.com/hashicorp/packer-plugin-sdk | cut -d " " -f2)
PLUGIN_FQN=$(shell grep -E '^module' <go.mod | sed -E 's/module \s*//')

deps:
go install github.com/golang/mock/mockgen@${MOCK_VERSION}
Expand All @@ -19,8 +20,7 @@ build: test
go build -v

install: build
mkdir -p ~/.packer.d/plugins
mv ./packer-plugin-amazon-ami-management ~/.packer.d/plugins/
packer plugins install --path ${BINARY} "$(shell echo "${PLUGIN_FQN}" | sed 's/packer-plugin-//')"

plugin-check: deps build
packer-sdc plugin-check ${BINARY}
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,10 @@ The post-processor requires additional permissions to work. Below is the differe

## Developing Plugin

If you want to build this plugin on your environment, you can use GNU Make build system.
This Makefile depends on [Go](https://golang.org/) 1.23 or more. At First, you should install Go.
To use the plugin built locally with Packer, you can use `make install`.

```
$ make build
$ make install
```

This command runs `go build` to generate the plugin binary and then installs the plugin with `packer plugins install`. This requires that you have Go v1.23+ and Packer v1.7+ installed.

0 comments on commit 1161515

Please sign in to comment.