diff --git a/.vib/common/goss/templates/check-linked-libraries.yaml b/.vib/common/goss/templates/check-linked-libraries.yaml index cf2b2a91669d..4d7f0aa27553 100644 --- a/.vib/common/goss/templates/check-linked-libraries.yaml +++ b/.vib/common/goss/templates/check-linked-libraries.yaml @@ -4,13 +4,18 @@ # - .Vars.root_dir # Optional vars: # - .Vars.linked_libraries.exclude_paths (Array) +# - .Vars.linked_libraries.timeout (String) ######################## command: check-linked-libraries: {{ $exclude_paths := "" }} - {{ if contains "linked_libraries:map[exclude_paths:" (.Vars | toString) }} + {{ if and (index .Vars "linked_libraries") (index .Vars.linked_libraries "exclude_paths")}} {{ $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 + {{ if and (index .Vars "linked_libraries") (index .Vars.linked_libraries "timeout")}} + timeout: {{ .Vars.linked_libraries.timeout }} + {{ else }} timeout: 20000 + {{ end }} exit-status: 0 diff --git a/.vib/discourse/goss/discourse.yaml b/.vib/discourse/goss/discourse.yaml new file mode 100644 index 000000000000..df48bf0bace0 --- /dev/null +++ b/.vib/discourse/goss/discourse.yaml @@ -0,0 +1,28 @@ +command: + check-discourse-plugin-install: + exec: cd /opt/bitnami/discourse; if [[ ! -d "plugins/discourse-voting" ]]; then RAILS_ENV=production bundle exec rake plugin:install repo=https://github.com/discourse/discourse-voting/; fi + exit-status: 0 + check-discourse-passenger-native-support: + exec: /opt/bitnami/discourse/bin/passenger-config build-native-support 2>&1 + exit-status: 0 + # Checks output is empty + stdout: + - '!/./' + check-terser-modules: + exec: npm list -g + exit-status: 0 + stdout: + - terser +file: + /opt/bitnami/discourse/.image_optim.yml: + exists: true + filetype: file + contains: + - "!timeout:" + - "svgo: false" +group: + discourse: + exists: true +user: + discourse: + exists: true diff --git a/.vib/discourse/goss/goss.yaml b/.vib/discourse/goss/goss.yaml new file mode 100644 index 000000000000..4044b5f067d1 --- /dev/null +++ b/.vib/discourse/goss/goss.yaml @@ -0,0 +1,11 @@ +gossfile: + # Goss tests exclusive to the current container + ../../discourse/goss/discourse.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-directories.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/discourse/goss/vars.yaml b/.vib/discourse/goss/vars.yaml new file mode 100644 index 000000000000..420153cdb685 --- /dev/null +++ b/.vib/discourse/goss/vars.yaml @@ -0,0 +1,26 @@ +binaries: + - wait-for-port + - python + - ruby + - node + - brotli + - psql + - bundle + - terser +directories: + - mode: "0775" + paths: + - /opt/bitnami/discourse + - /bitnami/discourse + - /opt/bitnami/discourse/plugins + - /opt/bitnami/discourse/public/backups + - /opt/bitnami/discourse/public/uploads + - /opt/bitnami/discourse/app/assets + - /opt/bitnami/discourse/log + - /opt/bitnami/discourse/public + - /opt/bitnami/discourse/tmp + - /home/discourse + - /home/discourse/.bundle +root_dir: /opt/bitnami +linked_libraries: + timeout: 60000 diff --git a/.vib/discourse/vib-publish.json b/.vib/discourse/vib-publish.json index 1e2aad8ef471..b0a30a08cfbb 100644 --- a/.vib/discourse/vib-publish.json +++ b/.vib/discourse/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": "discourse/goss/goss.yaml", + "vars_file": "discourse/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-discourse" + } + } + } + }, { "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/discourse/vib-verify.json b/.vib/discourse/vib-verify.json index a34e8aee9161..2a60e6a4dc80 100644 --- a/.vib/discourse/vib-verify.json +++ b/.vib/discourse/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": "discourse/goss/goss.yaml", + "vars_file": "discourse/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-discourse" + } + } + } + }, { "action_id": "trivy", "params": {