From d4aaf8bce46df06e5dc5a8f8c1cf45f720042457 Mon Sep 17 00:00:00 2001 From: Francisco de Paz Galan Date: Mon, 10 Apr 2023 16:39:35 +0200 Subject: [PATCH] [bitnami/jsonnet] Add VIB tests (#29331) * [bitnami/jsonnet] Add VIB tests Signed-off-by: FraPazGal * Trigger VIB Signed-off-by: FraPazGal * Add jsonnet test and remove ca one Signed-off-by: FraPazGal * Remove ca test Signed-off-by: FraPazGal * Remove VIB trigger Signed-off-by: FraPazGal * Remove unused files Signed-off-by: FraPazGal --------- Signed-off-by: FraPazGal --- .vib/jsonnet/goss/goss.yaml | 10 ++++++++ .vib/jsonnet/goss/jsonnet.yaml | 6 +++++ .../goss/testfiles/test_template.jsonnet | 6 +++++ .vib/jsonnet/goss/vars.yaml | 7 ++++++ .vib/jsonnet/vib-publish.json | 24 +++++++++++++++---- .vib/jsonnet/vib-verify.json | 18 +++++++++++++- 6 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 .vib/jsonnet/goss/goss.yaml create mode 100644 .vib/jsonnet/goss/jsonnet.yaml create mode 100644 .vib/jsonnet/goss/testfiles/test_template.jsonnet create mode 100644 .vib/jsonnet/goss/vars.yaml diff --git a/.vib/jsonnet/goss/goss.yaml b/.vib/jsonnet/goss/goss.yaml new file mode 100644 index 000000000000..6bf68fe8a565 --- /dev/null +++ b/.vib/jsonnet/goss/goss.yaml @@ -0,0 +1,10 @@ +gossfile: + # Goss tests exclusive to the current container + ../../jsonnet/goss/jsonnet.yaml: {} + # Load scripts from .vib/common/goss/templates + ../../common/goss/templates/check-app-version.yaml: {} + ../../common/goss/templates/check-binaries.yaml: {} + ../../common/goss/templates/check-broken-symlinks.yaml: {} + ../../common/goss/templates/check-linked-libraries.yaml: {} + ../../common/goss/templates/check-sed-in-place.yaml: {} + ../../common/goss/templates/check-spdx.yaml: {} diff --git a/.vib/jsonnet/goss/jsonnet.yaml b/.vib/jsonnet/goss/jsonnet.yaml new file mode 100644 index 000000000000..77bcb2785fa0 --- /dev/null +++ b/.vib/jsonnet/goss/jsonnet.yaml @@ -0,0 +1,6 @@ +command: + check-jsonnet-file: + exec: jsonnet ./jsonnet/goss/testfiles/test_template.jsonnet + exit-status: 0 + stdout: + - VIB diff --git a/.vib/jsonnet/goss/testfiles/test_template.jsonnet b/.vib/jsonnet/goss/testfiles/test_template.jsonnet new file mode 100644 index 000000000000..6bb1b4478a1e --- /dev/null +++ b/.vib/jsonnet/goss/testfiles/test_template.jsonnet @@ -0,0 +1,6 @@ +{ + test: { + name: 'VIB', + welcome: 'Hello World!', + }, +} diff --git a/.vib/jsonnet/goss/vars.yaml b/.vib/jsonnet/goss/vars.yaml new file mode 100644 index 000000000000..9d009cff86a5 --- /dev/null +++ b/.vib/jsonnet/goss/vars.yaml @@ -0,0 +1,7 @@ +binaries: + - jsonnet + - jsonnetfmt +root_dir: /opt/bitnami +version: + bin_name: jsonnet + flag: --version diff --git a/.vib/jsonnet/vib-publish.json b/.vib/jsonnet/vib-publish.json index 8b6fe8eab4e6..a5fc97894ce1 100644 --- a/.vib/jsonnet/vib-publish.json +++ b/.vib/jsonnet/vib-publish.json @@ -3,7 +3,8 @@ "resources": { "url": "{VIB_ENV_CONTAINER_URL}", "path": "{VIB_ENV_PATH}" - } + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" }, "phases": { "package": { @@ -77,9 +78,24 @@ "url": "{VIB_ENV_PACKAGES_JSON_URL}", "path": "/{VIB_ENV_PATH}", "authn": { - "header": "Authorization", - "token": "Bearer {VIB_ENV_GITHUB_TOKEN}" - } + "header": "Authorization", + "token": "Bearer {VIB_ENV_GITHUB_TOKEN}" + } + } + } + }, + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "jsonnet/goss/goss.yaml", + "vars_file": "jsonnet/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-jsonnet" + } } } } diff --git a/.vib/jsonnet/vib-verify.json b/.vib/jsonnet/vib-verify.json index a34e8aee9161..d72c91e4c4d2 100644 --- a/.vib/jsonnet/vib-verify.json +++ b/.vib/jsonnet/vib-verify.json @@ -3,7 +3,8 @@ "resources": { "url": "{SHA_ARCHIVE}", "path": "{VIB_ENV_PATH}" - } + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" }, "phases": { "package": { @@ -46,6 +47,21 @@ "OS" ] } + }, + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "jsonnet/goss/goss.yaml", + "vars_file": "jsonnet/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-jsonnet" + } + } + } } ] }