Skip to content

Commit

Permalink
Update build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ivoronin committed Mar 6, 2022
1 parent fba98d0 commit 7d1bcc7
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 26 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
#
# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `GPG_PASSPHRASE`
# secret. If you would rather own your own GPG handling, please fork this action
# or use an alternative one for key handling.
#
Expand Down Expand Up @@ -34,7 +34,7 @@ jobs:
uses: hashicorp/[email protected]
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
packer_cache
crash.log
packer-plugin-sshkey
.docs
docs.zip
21 changes: 8 additions & 13 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This is an example goreleaser.yaml file with some defaults.
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
env:
- CGO_ENABLED=0
Expand All @@ -9,23 +9,18 @@ before:
- go test ./...
# 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.
- /bin/sh -c "[ -d docs ] && zip -r docs.zip docs/"

This comment has been minimized.

Copy link
@nywilken

nywilken Mar 7, 2022

Contributor

Hi @ivoronin It looks like the steps needed for generating the docs.zip file that gets ingested by the Packer.io site have been removed. This fill is needed in order for Packer.io to publish the documentation for this plugin.

Looking at your recent changes I think you might've pulled in the updates from the scaffolding template repo, but are missing the make ci-release-docs

If this was in error can you please generate the docs.zip file and uploaded to the latest GitHub release.

#- 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
-
id: plugin-check
mod_timestamp: '{{ .CommitTimestamp }}'
hooks:
post:
# This will check plugin compatibility against latest version of Packer
- cmd: |
go install github.com/hashicorp/packer/cmd/packer-plugins-check@latest &&
packer-plugins-check -load={{ .Name }}
dir: "{{ dir .Path}}"
flags:
- -trimpath #removes all file system paths from the compiled executable
ldflags:
- '-s -w -X main.Version={{.Version}} -X main.VersionPrerelease= '
- '-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= '
goos:
- linux
goarch:
Expand All @@ -36,7 +31,7 @@ builds:
flags:
- -trimpath #removes all file system paths from the compiled executable
ldflags:
- '-s -w -X main.version={{.Version}} -X main.VersionPrerelease= '
- '-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= '
goos:
- freebsd
- windows
Expand Down Expand Up @@ -78,8 +73,8 @@ release:
# draft: true
# 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 extra_files config and the docs.zip command hook above.
extra_files:
- glob: ./docs.zip
#extra_files:
#- glob: ./docs.zip

changelog:
skip: true
31 changes: 20 additions & 11 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,34 @@ BINARY=packer-plugin-${NAME}
COUNT?=1
TEST?=$(shell go list ./...)

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

# go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@latest
generate:
@cd sshkey && go generate
.PHONY: dev

build: generate
build:
@go build -o ${BINARY}

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

run-example: dev
@packer build sshkey/test-fixtures/rsa.pkr.hcl
@mv ${BINARY} ~/.packer.d/plugins/${BINARY}

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
@rm -rf sshkey/packer_cache
@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

This comment has been minimized.

Copy link
@nywilken

nywilken Mar 7, 2022

Contributor

Apologies this command should not be executed as part of the generate target. I updated the template repo.

This comment has been minimized.

Copy link
@ivoronin

ivoronin Mar 7, 2022

Author Owner

fixed

# checkout the .docs folder for a preview of the docs

0 comments on commit 7d1bcc7

Please sign in to comment.