-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(refactor): plugin refactor for v4
- Loading branch information
1 parent
fb262d8
commit 5b80eac
Showing
52 changed files
with
3,134 additions
and
1,322 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,36 @@ | ||
name: golangci-lint | ||
on: | ||
push: | ||
paths: | ||
- '**.go' | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
permissions: | ||
# Required: allow read access to the content for analysis. | ||
contents: read | ||
# Optional: allow read access to pull request. Use with `only-new-issues` option. | ||
pull-requests: read | ||
# Optional: Allow write access to checks to allow the action to annotate code in the PR. | ||
checks: write | ||
|
||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.21' | ||
cache: false | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: v1.59.1 | ||
args: -c .golang-ci.yml -v --timeout=5m | ||
env: | ||
GO111MODULES: off |
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
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
example/packer_cache | ||
.envrc | ||
packer-plugin-goss | ||
*.tar |
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 @@ | ||
linters-settings: | ||
lll: | ||
line-length: 180 | ||
allow-leading-space: true | ||
linters: | ||
enable-all: true | ||
disable: | ||
- testpackage | ||
- forbidigo | ||
- paralleltest | ||
- wrapcheck | ||
- gochecknoglobals | ||
- varnamelen | ||
- funlen | ||
- gomnd | ||
- containedctx | ||
- nlreturn | ||
- wsl | ||
- err113 | ||
- exhaustruct | ||
- nolintlint | ||
- maintidx | ||
- dupl | ||
- revive | ||
- depguard | ||
- tagalign | ||
- perfsprint | ||
- godox | ||
- intrange | ||
- copyloopvar | ||
- gomoddirectives | ||
- goconst | ||
- godot | ||
- execinquery |
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
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,14 @@ | ||
repos: | ||
- repo: https://github.com/tekwizely/pre-commit-golang | ||
rev: v1.0.0-rc.1 | ||
hooks: | ||
- id: go-build-mod | ||
- id: go-test-mod | ||
- id: go-vet-mod | ||
- id: go-staticcheck-mod | ||
- id: go-fmt | ||
- id: go-fumpt | ||
- id: go-imports | ||
- id: go-lint | ||
- id: golangci-lint-mod | ||
args: [-c.golang-ci.yml] |
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,58 @@ | ||
E2E_DIR ?= example | ||
|
||
default: help | ||
|
||
.PHONY: help | ||
help: ## list makefile targets | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
PHONY: lint | ||
lint: ## lint go files | ||
golangci-lint run -c .golang-ci.yml | ||
|
||
.PHONY: fmt | ||
fmt: ## format go files | ||
gofumpt -w . | ||
gci write . | ||
packer fmt -recursive -write . | ||
|
||
.PHONY: build | ||
build: generate ## build the plugin | ||
go build -ldflags="-X github.com/YaleUniversity/packer-provisioner-goss/version.VersionPrerelease=dev" -o packer-plugin-goss | ||
|
||
.PHONY: install | ||
install: ## install the plugin | ||
packer plugins install --path packer-plugin-goss github.com/YaleUniversity/goss | ||
|
||
.PHONY: test | ||
test: ## run tests | ||
PACKER_ACC=1 gotestsum | ||
|
||
.PHONY: test-acc | ||
test-acc: clean build install ## run acceptance tests | ||
PACKER_ACC=1 go test -count 1 -v ./provisioner/goss/provisioner_goss_test.go -timeout=120m | ||
|
||
.PHONY: test-e2e | ||
test-e2e: clean build install ## run e2e tests | ||
cd $(E2E_DIR) && packer init . | ||
cd $(E2E_DIR) && packer build complete_example.pkr.hcl | ||
|
||
.PHONY: clean | ||
clean: ## remove tmp files | ||
rm -f $(E2E_DIR)/*.tar $(E2E_DIR)/test-results.xml packer-plugin-goss | ||
|
||
.PHONY: generate | ||
generate: ## go generate | ||
go generate ./... | ||
|
||
.PHONY: plugin-check | ||
plugin-check: build ## will check whether a plugin binary seems to work with packer | ||
@packer-sdc plugin-check packer-plugin-goss | ||
|
||
.PHONY: docs | ||
docs: ## gen packer plugin docs | ||
@go generate ./... | ||
@rm -rf .docs | ||
@packer-sdc renderdocs -src "docs" -partials docs-partials/ -dst ".docs/" | ||
@./.web-docs/scripts/compile-to-webdocs.sh "." ".docs" ".web-docs" "YaleUniversity" | ||
@rm -r ".docs" |
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
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,5 @@ | ||
<!-- Code generated from the comments of the Config struct in provisioner/goss/provisioner_goss.go; DO NOT EDIT MANUALLY --> | ||
|
||
- `installation` (Installation) - Installation | ||
|
||
<!-- End of code generated from the comments of the Config struct in provisioner/goss/provisioner_goss.go; --> |
25 changes: 25 additions & 0 deletions
25
docs-partials/provisioner/goss/Installation-not-required.mdx
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,25 @@ | ||
<!-- Code generated from the comments of the Installation struct in provisioner/goss/goss_installation.go; DO NOT EDIT MANUALLY --> | ||
|
||
- `use_sudo` (bool) - execute goss validate with sudo permissions | ||
|
||
- `version` (string) - / Goss Version to download | ||
|
||
- `arch` (string) - Architecture of the target system | ||
|
||
- `os` (string) - OS of the target system. | ||
|
||
- `url` (string) - URL to download the goss binary from. | ||
|
||
- `skip_ssl` (bool) - If true SSL checks are skipped. | ||
|
||
- `download_path` (string) - Path to download the goss binary to. | ||
|
||
- `username` (string) - Username for basic auth. | ||
|
||
- `password` (string) - Password for basic auth. | ||
|
||
- `env_vars` (map[string]string) - EnvVars any env vars. | ||
|
||
- `skip_installation` (bool) - If true installation of the goss binary is skipped. | ||
|
||
<!-- End of code generated from the comments of the Installation struct in provisioner/goss/goss_installation.go; --> |
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,5 @@ | ||
<!-- Code generated from the comments of the Installation struct in provisioner/goss/goss_installation.go; DO NOT EDIT MANUALLY --> | ||
|
||
Installation holds all installation params. | ||
|
||
<!-- End of code generated from the comments of the Installation struct in provisioner/goss/goss_installation.go; --> |
Oops, something went wrong.