Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile: make dev uses packer for install #184

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/test-plugin-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ jobs:
- name: Build packer plugin
run: |
cd $GITHUB_WORKSPACE
make dev
make build

- uses: actions/upload-artifact@v4
with:
name: packer-plugin-nutanix
path: ~/.config/packer/plugins/packer-plugin-nutanix
path: packer-plugin-nutanix
retention-days: 7

- name: build test list
Expand Down Expand Up @@ -70,11 +70,13 @@ jobs:
name: packer-plugin-nutanix
path: /tmp

- name: Fix plugin permissions
run: |
chmod +x /tmp/packer-plugin-nutanix

- name: Install plugin
run: |
mkdir -p ~/.config/packer/plugins/
cp /tmp/packer-plugin-nutanix ~/.config/packer/plugins/packer-plugin-nutanix
chmod 755 ~/.config/packer/plugins/packer-plugin-nutanix
packer plugins install --path /tmp/packer-plugin-nutanix "github.com/nutanix-cloud-native/nutanix"

- name: Run `packer init`
id: init
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
NAME=nutanix
BINARY=packer-plugin-${NAME}
PLUGIN_FQN="$(shell grep -E '^module' <go.mod | sed -E 's/module *//')"

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

dev: build
@mkdir -p ~/.config/packer/plugins
@mv ${BINARY} ~/.config/packer/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
Loading