diff --git a/.vib/golang/goss/golang.yaml b/.vib/golang/goss/golang.yaml new file mode 100644 index 000000000000..795435245635 --- /dev/null +++ b/.vib/golang/goss/golang.yaml @@ -0,0 +1,14 @@ +command: + # Major and Minor versions are often shown as "x.0" and "x.y" instead of "x.0.0" and "x.y.0" + check-app-version: + exec: go version | grep "$(echo $APP_VERSION | sed -E 's|([0-9]+\.[0-9]+)\.0$|\1|g')" + exit-status: 0 + check-go-build: + {{- $filename := printf "test_%s" (randAlpha 5) }} + exec: | + echo 'package main; import "fmt"; func main() { fmt.Println("Hello VIB") }' > {{ $filename }}.go && \ + go build {{ $filename }}.go && \ + ./{{ $filename }} + exit-status: 0 + stdout: + - Hello VIB diff --git a/.vib/golang/goss/goss.yaml b/.vib/golang/goss/goss.yaml new file mode 100644 index 000000000000..45ebdb913d16 --- /dev/null +++ b/.vib/golang/goss/goss.yaml @@ -0,0 +1,9 @@ +gossfile: + # Goss tests exclusive to the current container + ../../golang/goss/golang.yaml: {} + # Load scripts from .vib/common/goss/templates + ../../common/goss/templates/check-binaries.yaml: {} + ../../common/goss/templates/check-broken-symlinks.yaml: {} + ../../common/goss/templates/check-ca-certs.yaml: {} + ../../common/goss/templates/check-linked-libraries.yaml: {} + ../../common/goss/templates/check-sed-in-place.yaml: {} diff --git a/.vib/golang/goss/vars.yaml b/.vib/golang/goss/vars.yaml new file mode 100644 index 000000000000..6ca44601b3f3 --- /dev/null +++ b/.vib/golang/goss/vars.yaml @@ -0,0 +1,3 @@ +binaries: + - go +root_dir: /opt/bitnami diff --git a/.vib/golang/vib-publish.json b/.vib/golang/vib-publish.json index f58738648055..ffcb77bfa719 100644 --- a/.vib/golang/vib-publish.json +++ b/.vib/golang/vib-publish.json @@ -3,7 +3,8 @@ "resources": { "url": "{VIB_ENV_CONTAINER_URL}", "path": "{VIB_ENV_PATH}" - } + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" }, "phases": { "package": { @@ -33,6 +34,21 @@ }, "verify": { "actions": [ + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "golang/goss/goss.yaml", + "vars_file": "golang/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-golang" + } + } + } + }, { "action_id": "trivy", "params": { diff --git a/.vib/golang/vib-verify.json b/.vib/golang/vib-verify.json index 835cd556e241..03a810b5e27a 100644 --- a/.vib/golang/vib-verify.json +++ b/.vib/golang/vib-verify.json @@ -3,7 +3,8 @@ "resources": { "url": "{SHA_ARCHIVE}", "path": "{VIB_ENV_PATH}" - } + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" }, "phases": { "package": { @@ -29,6 +30,21 @@ }, "verify": { "actions": [ + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "golang/goss/goss.yaml", + "vars_file": "golang/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-golang" + } + } + } + }, { "action_id": "trivy", "params": { @@ -50,4 +66,4 @@ ] } } -} \ No newline at end of file +}