-
Notifications
You must be signed in to change notification settings - Fork 46
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
1 parent
652f867
commit 080a90b
Showing
32 changed files
with
2,474 additions
and
1,263 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,30 @@ | ||
name: E2E | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
e2e: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: hashicorp/setup-packer@main | ||
- | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.21' | ||
cache: false | ||
|
||
- run: | | ||
make e2e OS=linux | ||
if: matrix.os == 'ubuntu-latest' | ||
- run: | | ||
make e2e OS=windows | ||
if: matrix.os == 'windows-latest' |
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,6 +1,6 @@ | ||
example/packer_cache | ||
.envrc | ||
packer-plugin-goss | ||
tests/debug-goss-spec.yaml | ||
tests/goss-spec.yaml | ||
tests/goss.json | ||
e2e/debug-goss-spec.yaml | ||
e2e/goss-spec.yaml | ||
e2e/goss.json |
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,43 @@ | ||
linters-settings: | ||
lll: | ||
line-length: 180 | ||
allow-leading-space: true | ||
linters: | ||
enable-all: true | ||
disable: | ||
- scopelint | ||
- maligned | ||
- interfacer | ||
- golint | ||
- testpackage | ||
- forbidigo | ||
- paralleltest | ||
- exhaustivestruct | ||
- goerr113 | ||
- wrapcheck | ||
- gochecknoglobals | ||
- varnamelen | ||
- funlen | ||
- gomnd | ||
- containedctx | ||
- nlreturn | ||
- wsl | ||
- exhaustruct | ||
- nolintlint | ||
- maintidx | ||
- dupl | ||
- revive | ||
- depguard | ||
- tagalign | ||
- perfsprint | ||
- godox | ||
- structcheck | ||
- ifshort | ||
- deadcode | ||
- intrange | ||
- nosnakecase | ||
- varcheck | ||
- copyloopvar | ||
- gomoddirectives | ||
- goconst | ||
- godot |
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
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,42 @@ | ||
# fetch a normal alpine container and export the image as alpine.tar | ||
source "docker" "alpine" { | ||
image = "alpine" | ||
export_path = "alpine.tar" | ||
} | ||
|
||
build { | ||
# apply build params against the alpine container | ||
sources = ["docker.alpine"] | ||
|
||
# run goss tests using goss provisioner | ||
provisioner "goss" { | ||
|
||
# goss download parameter | ||
installation {} | ||
|
||
# goss render | ||
render { | ||
vars_file = "./vars.yaml" | ||
goss_file = "./goss.yaml" | ||
|
||
env_vars = { | ||
OS = "centos" | ||
} | ||
|
||
output_file = "goss-spec.yaml" | ||
} | ||
|
||
# goss validate parameter | ||
validate { | ||
goss_file = "./goss-spec.yaml" # created during goss render | ||
|
||
output_file = "goss_test_results.xml" | ||
} | ||
} | ||
|
||
|
||
# output the test results just for demo purposes | ||
provisioner "shell-local" { | ||
inline = ["cat goss_test_results.xml"] | ||
} | ||
} |
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,42 @@ | ||
# fetch a normal alpine container and export the image as alpine.tar | ||
source "docker" "windows" { | ||
image = "dockurr/windows" | ||
export_path = "windows.tar" | ||
} | ||
|
||
build { | ||
# apply build params against the alpine container | ||
sources = ["docker.windows"] | ||
|
||
# run goss tests using goss provisioner | ||
provisioner "goss" { | ||
|
||
# goss download parameter | ||
installation {} | ||
|
||
# goss render | ||
render { | ||
vars_file = "./vars.yaml" | ||
goss_file = "./goss.yaml" | ||
|
||
env_vars = { | ||
OS = "centos" | ||
} | ||
|
||
output_file = "goss-spec.yaml" | ||
} | ||
|
||
# goss validate parameter | ||
validate { | ||
goss_file = "./goss-spec.yaml" # created during goss render | ||
|
||
output_file = "goss_test_results.xml" | ||
} | ||
} | ||
|
||
|
||
# output the test results just for demo purposes | ||
provisioner "shell-local" { | ||
inline = ["cat goss_test_results.xml"] | ||
} | ||
} |
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,27 @@ | ||
package: | ||
# Looping over a variables defined in a vars.yaml using $OS environment variable as a lookup key | ||
{{range $name, $vers := index .Vars .Env.OS "packages"}} | ||
{{$name}}: | ||
installed: true | ||
versions: | ||
{{range $vers}} | ||
- {{.}} | ||
{{end}} | ||
{{end}} | ||
|
||
# This test is only when the OS environment variable matches the pattern | ||
{{if .Env.OS | regexMatch "[Cc]ent(OS|os)"}} | ||
libselinux: | ||
installed: true | ||
{{end}} | ||
|
||
# Loop over users | ||
user: | ||
{{range .Vars.users}} | ||
{{.}}: | ||
exists: true | ||
groups: | ||
- {{.}} | ||
home: /home/{{.}} | ||
shell: /bin/bash | ||
{{end}} |
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 @@ | ||
packer { | ||
required_version = ">= 1.9.0" | ||
|
||
required_plugins { | ||
goss = { | ||
version = "v0.0.1" | ||
source = "github.com/YaleUniversity/goss" | ||
} | ||
docker = { | ||
source = "github.com/hashicorp/docker" | ||
version = "v1.0.10" | ||
} | ||
} | ||
} |
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,13 @@ | ||
centos: | ||
packages: | ||
kernel: | ||
- "4.9.11-centos" | ||
- "4.9.11-centos2" | ||
debian: | ||
packages: | ||
kernel: | ||
- "4.9.11-debian" | ||
- "4.9.11-debian2" | ||
users: | ||
- user1 | ||
- user2 |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.