From 168c1178cce706082ce86536814b61a0224fdf68 Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Wed, 3 Jun 2026 16:38:37 -0400 Subject: [PATCH] allow tests/verify_mdb_properties.sh to be run in Docker #9176 --- tests/Dockerfile.verify_mdb_properties | 13 +++++++++++++ tests/README.md | 9 +++++++++ tests/verify_mdb_properties_docker.sh | 22 ++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 tests/Dockerfile.verify_mdb_properties create mode 100755 tests/verify_mdb_properties_docker.sh diff --git a/tests/Dockerfile.verify_mdb_properties b/tests/Dockerfile.verify_mdb_properties new file mode 100644 index 00000000000..cd6a036e2a4 --- /dev/null +++ b/tests/Dockerfile.verify_mdb_properties @@ -0,0 +1,13 @@ +FROM ghcr.io/graalvm/native-image-community:21 + +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +RUN microdnf install -y curl findutils git grep sed unzip which \ + && microdnf clean all + +RUN curl -Ls https://sh.jbang.dev | bash -s - app setup + +ENV PATH="/root/.jbang/bin:${PATH}" + +WORKDIR /workspace + diff --git a/tests/README.md b/tests/README.md index 03078383ac6..838016c4bbd 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1 +1,10 @@ See doc/sphinx-guides/source/developers/testing.rst + +To run the metadata block properties verifier in Docker, use: + +```bash +tests/verify_mdb_properties_docker.sh +``` + +This builds a local `dataverse-verify-mdb-properties` image with GraalVM native-image +and JBang, then runs `tests/verify_mdb_properties.sh` inside the container. diff --git a/tests/verify_mdb_properties_docker.sh b/tests/verify_mdb_properties_docker.sh new file mode 100755 index 00000000000..57b60647f69 --- /dev/null +++ b/tests/verify_mdb_properties_docker.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# Run verify_mdb_properties.sh in a Linux container with GraalVM native-image and JBang. + +set -euo pipefail + +if ! command -v docker > /dev/null 2>&1; then + echo "Cannot find docker on path. Did you install Docker Desktop or another Docker runtime?" >&2 + exit 1 +fi + +REPO_ROOT=$(git rev-parse --show-toplevel) +IMAGE=${VERIFY_MDB_PROPERTIES_IMAGE:-dataverse-verify-mdb-properties} +DOCKERFILE="$REPO_ROOT/tests/Dockerfile.verify_mdb_properties" + +docker build -f "$DOCKERFILE" -t "$IMAGE" "$REPO_ROOT" +docker run --rm \ + -v "$REPO_ROOT:/workspace" \ + -w /workspace \ + --entrypoint /bin/bash \ + "$IMAGE" \ + -lc 'git config --global --add safe.directory /workspace && tests/verify_mdb_properties.sh'