From 7248d5b587161c61c9eb54c142ecfa229c6ee94d Mon Sep 17 00:00:00 2001 From: Miguel Ruiz Date: Fri, 19 May 2023 10:42:52 +0200 Subject: [PATCH] [bitnami/jwt-cli] Add VIB tests (#34387) * [bitnami/jwt-cli] Add VIB tests Signed-off-by: Miguel Ruiz * Add trigger Signed-off-by: Miguel Ruiz * Remove trigger Signed-off-by: Miguel Ruiz --------- Signed-off-by: Miguel Ruiz --- .vib/jwt-cli/goss/goss.yaml | 11 +++++++++++ .vib/jwt-cli/goss/jwt-cli.yaml | 7 +++++++ .vib/jwt-cli/goss/vars.yaml | 6 ++++++ .vib/jwt-cli/vib-publish.json | 24 ++++++++++++++++++++---- .vib/jwt-cli/vib-verify.json | 18 +++++++++++++++++- 5 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 .vib/jwt-cli/goss/goss.yaml create mode 100644 .vib/jwt-cli/goss/jwt-cli.yaml create mode 100644 .vib/jwt-cli/goss/vars.yaml diff --git a/.vib/jwt-cli/goss/goss.yaml b/.vib/jwt-cli/goss/goss.yaml new file mode 100644 index 000000000000..81c236d646b6 --- /dev/null +++ b/.vib/jwt-cli/goss/goss.yaml @@ -0,0 +1,11 @@ +gossfile: + # Goss tests exclusive to the current container + ../../jwt-cli/goss/jwt-cli.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-ca-certs.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/jwt-cli/goss/jwt-cli.yaml b/.vib/jwt-cli/goss/jwt-cli.yaml new file mode 100644 index 000000000000..d33e38aa19a2 --- /dev/null +++ b/.vib/jwt-cli/goss/jwt-cli.yaml @@ -0,0 +1,7 @@ +command: + # From upstream example: https://github.com/mike-engel/jwt-cli#usage-as-a-pipe + check-jwt-encode: + exec: jwt encode --secret=fake '{"hello":"world"}' + exit-status: 0 + stdout: + - eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9 diff --git a/.vib/jwt-cli/goss/vars.yaml b/.vib/jwt-cli/goss/vars.yaml new file mode 100644 index 000000000000..ffe383c9c0c1 --- /dev/null +++ b/.vib/jwt-cli/goss/vars.yaml @@ -0,0 +1,6 @@ +binaries: + - jwt +root_dir: /opt/bitnami +version: + bin_name: jwt + flag: --version diff --git a/.vib/jwt-cli/vib-publish.json b/.vib/jwt-cli/vib-publish.json index 1e2aad8ef471..b17618dc567a 100644 --- a/.vib/jwt-cli/vib-publish.json +++ b/.vib/jwt-cli/vib-publish.json @@ -3,7 +3,8 @@ "resources": { "url": "{VIB_ENV_CONTAINER_URL}", "path": "{VIB_ENV_PATH}" - } + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" }, "phases": { "package": { @@ -32,6 +33,21 @@ }, "verify": { "actions": [ + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "jwt-cli/goss/goss.yaml", + "vars_file": "jwt-cli/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-jwt-cli" + } + } + } + }, { "action_id": "trivy", "params": { @@ -64,9 +80,9 @@ "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}" + } } } } diff --git a/.vib/jwt-cli/vib-verify.json b/.vib/jwt-cli/vib-verify.json index a34e8aee9161..87a454c2a88e 100644 --- a/.vib/jwt-cli/vib-verify.json +++ b/.vib/jwt-cli/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": "jwt-cli/goss/goss.yaml", + "vars_file": "jwt-cli/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-jwt-cli" + } + } + } + }, { "action_id": "trivy", "params": {