diff --git a/.vib/rails/goss/goss.yaml b/.vib/rails/goss/goss.yaml new file mode 100644 index 000000000000..7242791803a1 --- /dev/null +++ b/.vib/rails/goss/goss.yaml @@ -0,0 +1,10 @@ +gossfile: + # Goss tests exclusive to the current container + ../../rails/goss/rails.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: {} \ No newline at end of file diff --git a/.vib/rails/goss/rails.yaml b/.vib/rails/goss/rails.yaml new file mode 100644 index 000000000000..8e62106db7d3 --- /dev/null +++ b/.vib/rails/goss/rails.yaml @@ -0,0 +1,24 @@ +command: + # A new Rails project can be created + check-project: + timeout: 120000 + exec: "rails new /app && cd /app && timeout 10s rails s -p 4000 || true" + exit-status: 0 + stdout: + - Listening + check-app-version: + # The `APP_VERSION` environment variable returns the version in the format of + # Major.Minor.Patch-Build, such as 1.2.3-4 while the `rails -v` command returns + # the version in the format of Major.Minor.Patch.Build, such as 1.2.3.4 so we + # need to convert the environment variable before comparing the two versions + exec: {{ .Vars.version.bin_name }} {{ .Vars.version.flag }} | sed '/^[0-9]\+\.[0-9]\+\.[0-9]\+$/ s/$/-0/' | sed "s/\.\([0-9]\)$/-\1/" + exit-status: 0 + stdout: + - {{ .Env.APP_VERSION }} + check-installed-gems: + exec: gem list + exit-status: 0 + stdout: + {{ range $module := .Vars.modules }} + - {{ $module }} + {{ end }} diff --git a/.vib/rails/goss/vars.yaml b/.vib/rails/goss/vars.yaml new file mode 100644 index 000000000000..cf4192f10a7f --- /dev/null +++ b/.vib/rails/goss/vars.yaml @@ -0,0 +1,19 @@ +binaries: + - gosu + - mysql + - node + - python + - rails + - ruby +directories: + - mode: "0775" + paths: + - /app +root_dir: /opt/bitnami +version: + bin_name: rails + flag: --version +modules: + - sqlite3 + - mysql + - pg \ No newline at end of file diff --git a/.vib/rails/vib-publish.json b/.vib/rails/vib-publish.json index b95e5f947244..5898614f421f 100644 --- a/.vib/rails/vib-publish.json +++ b/.vib/rails/vib-publish.json @@ -3,7 +3,8 @@ "resources": { "url": "{VIB_ENV_CONTAINER_URL}", "path": "{VIB_ENV_PATH}" - } + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" }, "phases": { "package": { @@ -33,6 +34,21 @@ }, "verify": { "actions": [ + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "rails/goss/goss.yaml", + "vars_file": "rails/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-rails" + } + } + } + }, { "action_id": "trivy", "params": { @@ -93,4 +109,4 @@ ] } } -} +} \ No newline at end of file diff --git a/.vib/rails/vib-verify.json b/.vib/rails/vib-verify.json index 835cd556e241..4bb6e8f3c5c4 100644 --- a/.vib/rails/vib-verify.json +++ b/.vib/rails/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": "rails/goss/goss.yaml", + "vars_file": "rails/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-rails" + } + } + } + }, { "action_id": "trivy", "params": {