diff --git a/.vib/cassandra/goss/goss.yaml b/.vib/cassandra/goss/goss.yaml new file mode 100644 index 000000000000..ab4c4e971f47 --- /dev/null +++ b/.vib/cassandra/goss/goss.yaml @@ -0,0 +1,11 @@ +gossfile: + # 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-files.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/cassandra/goss/vars.yaml b/.vib/cassandra/goss/vars.yaml new file mode 100644 index 000000000000..9176895c6eaa --- /dev/null +++ b/.vib/cassandra/goss/vars.yaml @@ -0,0 +1,31 @@ +binaries: + - cassandra + - cqlsh + - python + - java + - gosu + - yq +files: + - mode: "0755" + paths: + - /opt/bitnami/cassandra/bin/cqlsh + - paths: + - /opt/bitnami/cassandra/conf.default +directories: + - mode: "0775" + paths: + - /.cassandra + - /bitnami/cassandra + - /bitnami/cassandra/conf + - /opt/bitnami/cassandra/tmp + - /opt/bitnami/cassandra/conf + - /opt/bitnami/cassandra/logs + - /docker-entrypoint-initdb.d +root_dir: /opt/bitnami +sed_in_place: + exclude_paths: + # Ignore PyLib directory (not bitnami-related) + - \/opt\/bitnami\/cassandra\/pylib\/.* +version: + bin_name: cassandra + flag: -v diff --git a/.vib/cassandra/vib-publish.json b/.vib/cassandra/vib-publish.json index ed6604df1a2e..f0274da78334 100644 --- a/.vib/cassandra/vib-publish.json +++ b/.vib/cassandra/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": "cassandra/goss/goss.yaml", + "vars_file": "cassandra/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-cassandra" + } + } + } + }, { "action_id": "trivy", "params": { diff --git a/.vib/cassandra/vib-verify.json b/.vib/cassandra/vib-verify.json index a34e8aee9161..7f1f3a905bcd 100644 --- a/.vib/cassandra/vib-verify.json +++ b/.vib/cassandra/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": "cassandra/goss/goss.yaml", + "vars_file": "cassandra/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-cassandra" + } + } + } + }, { "action_id": "trivy", "params": { diff --git a/.vib/common/goss/scripts/check-sed-in-place.sh b/.vib/common/goss/scripts/check-sed-in-place.sh index d7c89f754179..6b61f7432330 100755 --- a/.vib/common/goss/scripts/check-sed-in-place.sh +++ b/.vib/common/goss/scripts/check-sed-in-place.sh @@ -7,5 +7,8 @@ set -o pipefail mapfile -t files < <( find /bitnami "$BITNAMI_ROOT_DIR" -name '*.sh' ) for file in "${files[@]}"; do + if [[ -n $EXCLUDE_PATHS ]] && [[ "$file" =~ $EXCLUDE_PATHS ]]; then + continue + fi [[ $(grep -cE "sed -i|sed --in-place" "$file") -eq 0 ]] || exit 1 done diff --git a/.vib/common/goss/templates/check-directories.yaml b/.vib/common/goss/templates/check-directories.yaml index 3e72f51d7046..8e343a43ee99 100644 --- a/.vib/common/goss/templates/check-directories.yaml +++ b/.vib/common/goss/templates/check-directories.yaml @@ -4,7 +4,8 @@ # Needed vars: # - .Vars.directories (Array) # - .Vars.directories.paths (Array) -# - .Vars.directories.mode (Optional - String) +# Optional vars: +# - .Vars.directories.mode (String) ######################## file: {{ range .Vars.directories }} diff --git a/.vib/common/goss/templates/check-files.yaml b/.vib/common/goss/templates/check-files.yaml index 6d997c938338..8d8d7cf10bdf 100644 --- a/.vib/common/goss/templates/check-files.yaml +++ b/.vib/common/goss/templates/check-files.yaml @@ -4,7 +4,8 @@ # Needed vars: # - .Vars.files (Array) # - .Vars.files.paths (Array) -# - .Vars.files.mode (Optional - String) +# Optional vars: +# - .Vars.files.mode (String) ######################## file: {{ range .Vars.files }} diff --git a/.vib/common/goss/templates/check-linked-libraries.yaml b/.vib/common/goss/templates/check-linked-libraries.yaml index e8b4cdf3efee..cf2b2a91669d 100644 --- a/.vib/common/goss/templates/check-linked-libraries.yaml +++ b/.vib/common/goss/templates/check-linked-libraries.yaml @@ -2,12 +2,13 @@ # Check components executables have no missing linked libraries # Needed vars: # - .Vars.root_dir -# - .Vars.linked_libraries.exclude_paths (Optional - Array) +# Optional vars: +# - .Vars.linked_libraries.exclude_paths (Array) ######################## command: check-linked-libraries: {{ $exclude_paths := "" }} - {{ if contains "exclude_paths:" (.Vars | toString) }} + {{ if contains "linked_libraries:map[exclude_paths:" (.Vars | toString) }} {{ $exclude_paths = (.Vars.linked_libraries.exclude_paths | join "|") }} {{ end }} exec: export BITNAMI_ROOT_DIR={{ .Vars.root_dir }} && export EXCLUDE_PATHS='{{ $exclude_paths }}' && ./common/goss/scripts/check-linked-libraries.sh diff --git a/.vib/common/goss/templates/check-sed-in-place.yaml b/.vib/common/goss/templates/check-sed-in-place.yaml index c28be4eeeb05..d930e331851d 100644 --- a/.vib/common/goss/templates/check-sed-in-place.yaml +++ b/.vib/common/goss/templates/check-sed-in-place.yaml @@ -3,8 +3,15 @@ # to sed commands with the in-place argument # Needed vars: # - .Vars.root_dir +# Optional vars: +# - .Vars.sed_in_place.exclude_paths (Array) ######################## command: check-sed-in-place: - exec: export BITNAMI_ROOT_DIR={{ .Vars.root_dir }} && ./common/goss/scripts/check-sed-in-place.sh + {{ $exclude_paths := "" }} + {{ if contains "sed_in_place:map[exclude_paths:" (.Vars | toString) }} + {{ $exclude_paths = (.Vars.sed_in_place.exclude_paths | join "|") }} + {{ end }} + exec: export BITNAMI_ROOT_DIR={{ .Vars.root_dir }} && export EXCLUDE_PATHS='{{ $exclude_paths }}' && ./common/goss/scripts/check-sed-in-place.sh + timeout: 20000 exit-status: 0