Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
FalcoSuessgott committed Jul 9, 2024
1 parent 652f867 commit b1cc6c9
Show file tree
Hide file tree
Showing 61 changed files with 3,380 additions and 1,413 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/lint.yaml
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
50 changes: 50 additions & 0 deletions .github/workflows/notify-integration-release-via-manual.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Manual release workflow is used for deploying documentation updates
# on the specified branch without making an official plugin release.
name: Notify Integration Release (Manual)
on:
workflow_dispatch:
inputs:
version:
description: "The release version (semver)"
default: 1.0.0
required: false
branch:
description: "A branch or SHA"
default: 'main'
required: false
jobs:
notify-release:
runs-on: ubuntu-latest
steps:
- name: Checkout this repo
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
ref: ${{ github.event.inputs.branch }}
# Ensure that Docs are Compiled
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
- shell: bash
run: make generate
- shell: bash
run: |
if [[ -z "$(git status -s)" ]]; then
echo "OK"
else
echo "Docs have been updated, but the compiled docs have not been committed."
echo "Run 'make generate', and commit the result to resolve this error."
exit 1
fi
# Perform the Release
- name: Checkout integration-release-action
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
repository: hashicorp/integration-release-action
path: ./integration-release-action
- name: Notify Release
uses: ./integration-release-action
with:
# The integration identifier will be used by the Packer team to register the integration
# the expected format is packer/<GitHub Org Name>/<plugin-name>
integration_identifier: "packer/hashicorp/scaffolding"
release_version: ${{ github.event.inputs.version }}
release_sha: ${{ github.event.inputs.branch }}
github_token: ${{ secrets.GITHUB_TOKEN }}
54 changes: 54 additions & 0 deletions .github/workflows/notify-integration-release-via-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Notify Integration Release (Tag)
on:
push:
tags:
- '*.*.*' # Proper releases
jobs:
strip-version:
runs-on: ubuntu-latest
outputs:
packer-version: ${{ steps.strip.outputs.packer-version }}
steps:
- name: Strip leading v from version tag
id: strip
env:
REF: ${{ github.ref_name }}
run: |
echo "packer-version=$(echo "$REF" | sed -E 's/v?([0-9]+\.[0-9]+\.[0-9]+)/\1/')" >> "$GITHUB_OUTPUT"
notify-release:
needs:
- strip-version
runs-on: ubuntu-latest
steps:
- name: Checkout this repo
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
ref: ${{ github.ref }}
# Ensure that Docs are Compiled
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
- shell: bash
run: make generate
- shell: bash
run: |
if [[ -z "$(git status -s)" ]]; then
echo "OK"
else
echo "Docs have been updated, but the compiled docs have not been committed."
echo "Run 'make generate', and commit the result to resolve this error."
exit 1
fi
# Perform the Release
- name: Checkout integration-release-action
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
repository: hashicorp/integration-release-action
path: ./integration-release-action
- name: Notify Release
uses: ./integration-release-action
with:
# The integration identifier will be used by the Packer team to register the integration
# the expected format is packer/<GitHub Org Name>/<plugin-name>
integration_identifier: "packer/hashicorp/scaffolding"
release_version: ${{ needs.strip-version.outputs.packer-version }}
release_sha: ${{ github.ref }}
github_token: ${{ secrets.GITHUB_TOKEN }}
22 changes: 19 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,30 @@ jobs:

steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: false

- run: go generate -tags tools tools/tools.go

- uses: hashicorp/setup-packer@main

- run: |
make build
make install
packer plugin install github.com/hashicorp/docker
- name: go get
run: go get ./...

- name: Run tests
run: go test -v ./...
- name: unit tests
run: make test
env:
PACKER_ACC: 1

- name: acc tests
run: make test-acc

- name: e2e tests
run: make test-e2e
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
example/packer_cache
.envrc
packer-plugin-goss
tests/debug-goss-spec.yaml
tests/goss-spec.yaml
tests/goss.json
*.tar
34 changes: 34 additions & 0 deletions .golang-ci.yml
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
2 changes: 2 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ env:
- PACKER_PROTOCOL_VERSION=x5.0
before:
hooks:
- go generate -tags tools tools/tools.go
- go mod tidy
- go test ./...
- make plugin-check
builds:
-
id: plugin-check
Expand Down
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
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]
1 change: 1 addition & 0 deletions .web-docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# packer provisioner goss
45 changes: 45 additions & 0 deletions .web-docs/metadata.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Details on using this Integration template can be found at https://github.com/hashicorp/integration-template
# This metadata.hcl file and the adjacent `components` docs directory should
# be kept in a `.web-docs` directory at the root of your plugin repository.
integration {
name = "Integration Template"
description = "This is an integration template"
identifier = "packer/hashicorp/scaffolding"
flags = [
# Remove if the plugin does not conform to the HCP Packer requirements.
#
# Please refer to our docs if you want your plugin to be compatible with
# HCP Packer: https://developer.hashicorp.com/packer/docs/plugins/creation/hcp-support
"hcp-ready",
# This signals that the plugin is unmaintained and will eventually not be
# working with a future version of Packer.
#
# On the integrations, this will end-up as an icon on the plugin's main card.
"archived",
]
docs {
# If you'd prefer not to publish docs on HashiCorp websites, you can
# set `process_docs` to `false`. If `process_docs` is `false`, you MUST
# provide a `external_url` so we can link back to your plugin repo.
process_docs = true
# Note that the README location is relative to this file. We recommend
# keeping the default value, as the adjacent `compile-to-webdocs` script
# will automatically copy the README from the `docs` directory of this
# repository to the correct location.
readme_location = "./README.md"
# `external_url` allows us to link back to your plugin repo.
external_url = "https://github.com/hashicorp/integration-template"
}
license {
type = "MPL-2.0"
url = "https://github.com/hashicorp/integration-template/blob/main/LICENSE.md"
}
component {
type = "provisioner"
name = "Component Name (e.g HappyCloud Shell)"
slug = "name"
}
}
Loading

0 comments on commit b1cc6c9

Please sign in to comment.