Files
secs-gem/interop/secs4j_validate.sh
T
raphael 5fec47ad02 ci: bake secs4j harness into image instead of bind-mounting
Second secs4j-interop CI failure:
  ensuring secs4j-interop image is built...
  compiling Secs4jHostHarness.java...
  error: file not found: Secs4jHostHarness.java
  FAIL: javac

The script bind-mounted $PWD/interop/secs4j into /work inside the
container so it could javac the harness at runtime.  That works
locally where docker daemon and script share a filesystem, but
fails in CI: the act runner runs the workflow inside a container,
the docker socket is mounted from the host, and the daemon
interprets bind-mount paths against the host filesystem — where
$PWD/interop/secs4j doesn't exist.  Result: empty /work, javac
errors, job fails.

Fix: COPY Secs4jHostHarness.java into the image and javac it at
image build time.  The script just runs the container — no bind
mount, no docker-in-docker mount path translation, works in CI and
locally.

Verified locally with a fresh image rebuild: 55/55 checks pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-09 19:54:32 +02:00

47 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Orchestrate the secs4java8 interop harness against our C++ server.
#
# Boots secs_server on the docker bridge, then runs the Java harness
# in its own container against it. Wired into CI via a separate
# job (see .gitea/workflows/ci.yml).
#
# Usage: bash interop/secs4j_validate.sh
# Exit codes:
# 0 — every check the harness defines passed
# 1 — one or more checks failed
# 2 — script / orchestration error
set -euo pipefail
PORT=${PORT:-5099}
cd "$(dirname "$0")/.."
# Ensure the secs4j-interop image is built (idempotent). The image
# COPYs Secs4jHostHarness.java in and compiles it at build time, so
# no bind mount is needed at run time — important because docker-
# in-docker (CI runners with a mounted /var/run/docker.sock) can't
# bind-mount paths from the container's filesystem to the daemon's.
echo "ensuring secs4j-interop image is built..."
docker build -t secsgem-secs4j-interop -f interop/secs4j/Dockerfile interop/secs4j \
>/dev/null 2>&1
# Start the C++ server in background on the compose bridge network so
# the secs4j container can DNS-resolve it.
echo "starting secs_server (compose)..."
docker compose up -d server >/dev/null 2>&1
trap 'docker compose stop server >/dev/null 2>&1 || true' EXIT
# Give the server a moment to bind.
sleep 1
# Run the harness on the same compose network as the server, against
# the compose-defined hostname "server" on port 5000 (the demo
# server's default).
echo "running Secs4jHostHarness..."
docker run --rm \
--network secs-gem_secs \
secsgem-secs4j-interop \
java -cp /opt/secs4java8/Export.jar:/work Secs4jHostHarness server 5000
# trap handles teardown.