From a4950cb286a1c10339ff2706edf4947d2ceca249 Mon Sep 17 00:00:00 2001 From: Francisco de Paz Galan Date: Thu, 23 Feb 2023 19:04:25 +0100 Subject: [PATCH] [bitnami/dotnet-sdk] Add VIB tests (#24143) * [bitnami/dotnet-sdk] Add VIB tests Signed-off-by: FraPazGal * Remove VIB trigger Signed-off-by: FraPazGal * Add missing compilation tests Signed-off-by: FraPazGal * Remove VIB trigger Signed-off-by: FraPazGal * Implement additional test Signed-off-by: FraPazGal * Adapt test to work in both supported majors Signed-off-by: FraPazGal * Remove VIB trigger Signed-off-by: FraPazGal * Update pipelines' DSL definitions Signed-off-by: FraPazGal * Remove VIB trigger Signed-off-by: FraPazGal --------- Signed-off-by: FraPazGal --- .vib/dotnet-sdk/goss/dotnet-sdk.yaml | 30 ++++++++++++++++++++++++++++ .vib/dotnet-sdk/goss/goss.yaml | 11 ++++++++++ .vib/dotnet-sdk/goss/vars.yaml | 16 +++++++++++++++ .vib/dotnet-sdk/vib-publish.json | 18 ++++++++++++++++- .vib/dotnet-sdk/vib-verify.json | 20 +++++++++++++++++-- 5 files changed, 92 insertions(+), 3 deletions(-) create mode 100644 .vib/dotnet-sdk/goss/dotnet-sdk.yaml create mode 100644 .vib/dotnet-sdk/goss/goss.yaml create mode 100644 .vib/dotnet-sdk/goss/vars.yaml diff --git a/.vib/dotnet-sdk/goss/dotnet-sdk.yaml b/.vib/dotnet-sdk/goss/dotnet-sdk.yaml new file mode 100644 index 000000000000..06549d55cd31 --- /dev/null +++ b/.vib/dotnet-sdk/goss/dotnet-sdk.yaml @@ -0,0 +1,30 @@ +command: + check-bin-caps: + exec: getcap {{ .Vars.root_dir }}/dotnet-sdk/bin/dotnet + stdout: + - {{ .Vars.binary.capabilities }} + exit-status: 0 + check-installed-runtimes: + exec: dotnet --list-runtimes + stdout: + - AspNetCore.App + - NETCore.App + exit-status: 0 + check-installed-sdks: + exec: dotnet --list-sdks + stdout: + - {{ .Env.APP_VERSION }} + exit-status: 0 + create-dotnet-project: + exec: dotnet new -i CamundaProcessTemplate --force && dotnet new CamundaProcess -n VIBInstance --force + exit-status: 0 +file: + # Checks the postunpack phase properly creates the lib's symlink + /lib64/libz.so: + exists: true + filetype: symlink + linked-to: /usr/lib/libz.so.1 + # Checks the permission change done at compilation + /opt/bitnami/dotnet-sdk/bin/sdk/{{ .Env.APP_VERSION }}/AppHostTemplate/apphost: + exists: true + mode: "0755" diff --git a/.vib/dotnet-sdk/goss/goss.yaml b/.vib/dotnet-sdk/goss/goss.yaml new file mode 100644 index 000000000000..3fe4def5e6f9 --- /dev/null +++ b/.vib/dotnet-sdk/goss/goss.yaml @@ -0,0 +1,11 @@ +gossfile: + # Goss tests exclusive to the current container + ../../dotnet-sdk/goss/dotnet-sdk.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-directories.yaml: {} + ../../common/goss/templates/check-linked-libraries.yaml: {} + ../../common/goss/templates/check-sed-in-place.yaml: {} diff --git a/.vib/dotnet-sdk/goss/vars.yaml b/.vib/dotnet-sdk/goss/vars.yaml new file mode 100644 index 000000000000..41795a70807d --- /dev/null +++ b/.vib/dotnet-sdk/goss/vars.yaml @@ -0,0 +1,16 @@ +binaries: + - dotnet +directories: + - paths: + - /app + mode: "0775" + - paths: + - /opt/bitnami/dotnet-sdk/bin/host + - /opt/bitnami/dotnet-sdk/bin/shared + - /opt/bitnami/dotnet-sdk/bin/sdk +root_dir: /opt/bitnami +version: + bin_name: dotnet + flag: --version +binary: + capabilities: cap_net_bind_service=eip diff --git a/.vib/dotnet-sdk/vib-publish.json b/.vib/dotnet-sdk/vib-publish.json index c3b18078c0ce..6912f9094cbd 100644 --- a/.vib/dotnet-sdk/vib-publish.json +++ b/.vib/dotnet-sdk/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": "dotnet-sdk/goss/goss.yaml", + "vars_file": "dotnet-sdk/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-dotnet-sdk" + } + } + } + }, { "action_id": "trivy", "params": { diff --git a/.vib/dotnet-sdk/vib-verify.json b/.vib/dotnet-sdk/vib-verify.json index 835cd556e241..aa3576c1c0ea 100644 --- a/.vib/dotnet-sdk/vib-verify.json +++ b/.vib/dotnet-sdk/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": "dotnet-sdk/goss/goss.yaml", + "vars_file": "dotnet-sdk/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-dotnet-sdk" + } + } + } + }, { "action_id": "trivy", "params": { @@ -50,4 +66,4 @@ ] } } -} \ No newline at end of file +}