generated from hashicorp/packer-plugin-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit abb9ed4
Showing
39 changed files
with
3,014 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# This GitHub action can publish assets for release when a tag is created. | ||
# 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 `GPG_PASSPHRASE` | ||
# secret. If you would rather own your own GPG handling, please fork this action | ||
# or use an alternative one for key handling. | ||
# | ||
# You will need to pass the `--batch` flag to `gpg` in your signing step | ||
# in `goreleaser` to indicate this is being used in a non-interactive mode. | ||
# | ||
name: release | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Unshallow | ||
run: git fetch --prune --unshallow | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
- name: Describe plugin | ||
id: plugin_describe | ||
run: echo "::set-output name=api_version::$(go run . describe | jq -r '.api_version')" | ||
- name: Import GPG key | ||
id: import_gpg | ||
uses: crazy-max/ghaction-import-gpg@v5 | ||
with: | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
API_VERSION: ${{ steps.plugin_describe.outputs.api_version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# This is a manually triggered action workflow. | ||
# It uses Packer at latest version to init, validate and build | ||
# an example configuration in a folder. | ||
# This action is compatible with Packer v1.7.0 or later. | ||
name: test plugin example | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
logs: | ||
description: 'Set 1 to activate full logs' | ||
required: false | ||
default: '0' | ||
folder: | ||
description: 'Example folder' | ||
required: false | ||
default: './example' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
name: init and build example | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Init | ||
uses: hashicorp/packer-github-actions@master | ||
with: | ||
working_directory: ${{ github.event.inputs.folder }} | ||
command: init | ||
|
||
- name: Validate | ||
uses: hashicorp/packer-github-actions@master | ||
with: | ||
working_directory: ${{ github.event.inputs.folder }} | ||
command: validate | ||
env: | ||
PACKER_LOG: ${{ github.event.inputs.logs }} | ||
|
||
- name: Build | ||
uses: hashicorp/packer-github-actions@master | ||
with: | ||
working_directory: ${{ github.event.inputs.folder }} | ||
command: build | ||
env: | ||
PACKER_LOG: ${{ github.event.inputs.logs }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
main | ||
packer-plugin-scaffolding | ||
**/packer_log*.txt | ||
**/git_*test.pkr.hcl | ||
crash.log | ||
|
||
dist/* | ||
.docs/* | ||
docs.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# 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 | ||
before: | ||
hooks: | ||
# We strongly recommend running tests to catch any regression before release. | ||
# Even though, this an optional step. | ||
- 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. | ||
#- 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 }}' | ||
flags: | ||
- -trimpath #removes all file system paths from the compiled executable | ||
ldflags: | ||
- '-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= ' | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
binary: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}' | ||
- | ||
mod_timestamp: '{{ .CommitTimestamp }}' | ||
flags: | ||
- -trimpath #removes all file system paths from the compiled executable | ||
ldflags: | ||
- '-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= ' | ||
goos: | ||
- netbsd | ||
- solaris | ||
- openbsd | ||
- freebsd | ||
- windows | ||
- linux | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- '386' | ||
- arm | ||
- arm64 | ||
ignore: | ||
- goos: openbsd | ||
goarch: arm64 | ||
- goos: darwin | ||
goarch: '386' | ||
- goos: linux | ||
goarch: amd64 | ||
binary: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}' | ||
archives: | ||
- format: zip | ||
files: | ||
- none* | ||
name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}' | ||
checksum: | ||
name_template: '{{ .ProjectName }}_v{{ .Version }}_SHA256SUMS' | ||
algorithm: sha256 | ||
signs: | ||
- artifacts: checksum | ||
args: | ||
# if you are using this is in a GitHub action or some other automated pipeline, you | ||
# need to pass the batch flag to indicate its not interactive. | ||
- "--batch" | ||
- "--local-user" | ||
- "{{ .Env.GPG_FINGERPRINT }}" | ||
- "--output" | ||
- "${signature}" | ||
- "--detach-sign" | ||
- "${artifact}" | ||
release: | ||
# If you want to manually examine the release before its live, uncomment this line: | ||
# 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 | ||
|
||
changelog: | ||
skip: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
NAME=scaffolding | ||
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} | ||
|
||
dev: build | ||
@mkdir -p ~/.packer.d/plugins/ | ||
@mv ${BINARY} ~/.packer.d/plugins/${BINARY} | ||
|
||
test: | ||
@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 ./... |
Oops, something went wrong.