From 5213a9702a61aeae904b011120863ca444ab99fa Mon Sep 17 00:00:00 2001 From: Javier Salmeron Garcia Date: Thu, 20 Jul 2023 12:29:44 +0200 Subject: [PATCH] test: :construction_worker: Add tests Signed-off-by: Javier Salmeron Garcia --- .vib/deepspeed/goss/deepspeed.yaml | 13 +++ .vib/deepspeed/goss/goss.yaml | 14 +++ .vib/deepspeed/goss/vars.yaml | 11 ++ .vib/deepspeed/vib-publish.json | 123 +++++++++++++++++++++++ .vib/deepspeed/vib-verify.json | 65 ++++++++++++ bitnami/deepspeed/0/debian-11/Dockerfile | 1 + 6 files changed, 227 insertions(+) create mode 100644 .vib/deepspeed/goss/deepspeed.yaml create mode 100644 .vib/deepspeed/goss/goss.yaml create mode 100644 .vib/deepspeed/goss/vars.yaml create mode 100644 .vib/deepspeed/vib-publish.json create mode 100644 .vib/deepspeed/vib-verify.json diff --git a/.vib/deepspeed/goss/deepspeed.yaml b/.vib/deepspeed/goss/deepspeed.yaml new file mode 100644 index 0000000000000..12d099e9e8c04 --- /dev/null +++ b/.vib/deepspeed/goss/deepspeed.yaml @@ -0,0 +1,13 @@ +# Copyright VMware, Inc. +# SPDX-License-Identifier: APACHE-2.0 + +user: + deepspeed: + exists: true + uid: 1001 + gid: 0 +command: + check-necessary-libraries: + exec: python -c 'import deepspeed; print(deepspeed.__version__); import torch; print(torch.__version__); import torchvision; print(torchvision.__version__)' + timeout: 8000 + exit-status: 0 diff --git a/.vib/deepspeed/goss/goss.yaml b/.vib/deepspeed/goss/goss.yaml new file mode 100644 index 0000000000000..1016b36f5de35 --- /dev/null +++ b/.vib/deepspeed/goss/goss.yaml @@ -0,0 +1,14 @@ +# Copyright VMware, Inc. +# SPDX-License-Identifier: APACHE-2.0 + +gossfile: + # Goss tests exclusive to the current container + ../../deepspeed/goss/deepspeed.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-spdx.yaml: {} diff --git a/.vib/deepspeed/goss/vars.yaml b/.vib/deepspeed/goss/vars.yaml new file mode 100644 index 0000000000000..6c42e1bf220bb --- /dev/null +++ b/.vib/deepspeed/goss/vars.yaml @@ -0,0 +1,11 @@ +binaries: + - python + - deepspeed +root_dir: /opt/bitnami +directories: + - paths: + # Paths to the client and server directories + - /opt/bitnami/python +version: + bin_name: python + flag: "-c 'import deepspeed; print(deepspeed.__version__)'" diff --git a/.vib/deepspeed/vib-publish.json b/.vib/deepspeed/vib-publish.json new file mode 100644 index 0000000000000..17af354953035 --- /dev/null +++ b/.vib/deepspeed/vib-publish.json @@ -0,0 +1,123 @@ +{ + "context": { + "resources": { + "url": "{VIB_ENV_CONTAINER_URL}", + "path": "{VIB_ENV_PATH}" + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" + }, + "phases": { + "package": { + "actions": [ + { + "action_id": "container-image-package", + "params": { + "application": { + "details": { + "name": "{VIB_ENV_CONTAINER}", + "tag": "{VIB_ENV_TAG}" + } + }, + "architectures": [ + "linux/amd64", + "linux/arm64" + ] + } + }, + { + "action_id": "container-image-lint", + "params": { + "threshold": "error" + } + } + ] + }, + "verify": { + "actions": [ + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "deepspeed/goss/goss.yaml", + "vars_file": "deepspeed/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-deepspeed" + } + } + } + }, + { + "action_id": "trivy", + "params": { + "threshold": "CRITICAL", + "vuln_type": [ + "OS" + ] + } + }, + { + "action_id": "grype", + "params": { + "threshold": "CRITICAL", + "package_type": [ + "OS" + ] + } + }, + { + "action_id": "osspi-application", + "params": { + "additional_packages_file": "osspi-packages-amd64.json", + "scan_type": "BASE_OS", + "osm": { + "associated_bossd_release": "{VIB_ENV_BOSSD_RELEASE_ID}", + "product_name": "main-catalog-{VIB_ENV_CONTAINER}", + "product_version": "{VIB_ENV_APP_VERSION}-{VIB_ENV_OS_FLAVOUR}-container", + "architecture_overrides": [ + { + "architecture": "linux/amd64", + "product_version": "{VIB_ENV_APP_VERSION}-{VIB_ENV_OS_FLAVOUR}-container", + "additional_packages_file": "osspi-packages-amd64.json" + }, + { + "architecture": "linux/arm64", + "product_version": "{VIB_ENV_APP_VERSION}-{VIB_ENV_OS_FLAVOUR}-container-arm64", + "additional_packages_file": "osspi-packages-arm64.json" + } + ] + }, + "resources": { + "url": "{VIB_ENV_PACKAGES_JSON_URL}", + "path": "/{VIB_ENV_PATH}", + "authn": { + "header": "Authorization", + "token": "Bearer {VIB_ENV_GITHUB_TOKEN}" + } + } + } + } + ] + }, + "publish": { + "actions": [ + { + "action_id": "container-image-publish", + "params": { + "metadata": { + "tags": {VIB_ENV_ROLLING_TAGS} + }, + "repository": { + "kind": "OCI", + "url": "{VIB_ENV_REGISTRY_URL}", + "username": "{VIB_ENV_REGISTRY_USERNAME}", + "password": "{VIB_ENV_REGISTRY_PASSWORD}" + } + } + } + ] + } + } +} diff --git a/.vib/deepspeed/vib-verify.json b/.vib/deepspeed/vib-verify.json new file mode 100644 index 0000000000000..0e4f80c4e892b --- /dev/null +++ b/.vib/deepspeed/vib-verify.json @@ -0,0 +1,65 @@ +{ + "context": { + "resources": { + "url": "{SHA_ARCHIVE}", + "path": "{VIB_ENV_PATH}" + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" + }, + "phases": { + "package": { + "actions": [ + { + "action_id": "container-image-package", + "params": { + "application": { + "details": { + "name": "{VIB_ENV_CONTAINER}", + "tag": "{VIB_ENV_TAG}" + } + } + } + }, + { + "action_id": "container-image-lint", + "params": { + "threshold": "error" + } + } + ] + }, + "verify": { + "actions": [ + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "deepspeed/goss/goss.yaml", + "vars_file": "deepspeed/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-deepspeed" + } + } + } + }, + { + "action_id": "trivy", + "params": { + "threshold": "CRITICAL", + "vuln_type": ["OS"] + } + }, + { + "action_id": "grype", + "params": { + "threshold": "CRITICAL", + "package_type": ["OS"] + } + } + ] + } + } +} diff --git a/bitnami/deepspeed/0/debian-11/Dockerfile b/bitnami/deepspeed/0/debian-11/Dockerfile index cb4b0034395d0..b92a70ef50c77 100644 --- a/bitnami/deepspeed/0/debian-11/Dockerfile +++ b/bitnami/deepspeed/0/debian-11/Dockerfile @@ -43,6 +43,7 @@ RUN apt-get autoremove --purge -y curl && \ apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives RUN chmod g+rwX /opt/bitnami RUN mkdir /.local && chmod g+rwX /.local +RUN useradd -r -u 1001 -g root jax RUN mkdir /app /.cache && chmod g+rwX /app /.cache ENV APP_VERSION="0.10.0" \