mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
The Quarkus container build of the native binary failed on Apple Silicon with GraalVM's BranchTargetOutOfBoundsException in a generated AwsQueryController invoker (Quarkus 3.39 turns on -H:+AOTSingleCallsiteInline for Mandrel 25.0.4+), and the packaged image died at startup because the builder links zlib dynamically while ubi9-micro ships no libz.so.1. `make native` passes the same flags CI does (-Ob,-H:-AOTSingleCallsiteInline), stages native/<arch>/ like the workflow, and copies libz.so.1 from the builder image next to the binary, which Dockerfile.native-package now puts on LD_LIBRARY_PATH. The Makefile becomes the entry point for development: help (default), dev, build, test T=, native (container build), native-host (host GraalVM/Mandrel, adding the Mandrel-only flag when native-image reports Mandrel), run-native, native-install (PREFIX, default ~/.local), native-image, native-up/native-down/ native-logs against a new docker/compose.native.yml overlay that carries the five CI compat env vars, clean-sidecars, clean-volumes (a leftover ECR registry volume is re-adopted on start and breaks the CDK bootstrap), compat SUITES= and docker-tests. docker/run-docker-tests.sh gains FLOCI_START=0 and COMPAT_SUITES, validated against the suite list, and its shell test covers both. Docs: installation (native section rewritten), docker-images, CONTRIBUTING, AGENTS.
158 lines
3.5 KiB
Bash
Executable File
158 lines
3.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
REPO_ROOT=$(cd "$SCRIPT_DIR/.." && pwd)
|
|
LOG_FILE=$(mktemp)
|
|
trap 'rm -f "$LOG_FILE"' EXIT
|
|
|
|
export DOCKER_TEST_LOG="$LOG_FILE"
|
|
export FAIL_RUN_SUITE=sdk-test-node
|
|
export FAIL_BUILD_SUITE=
|
|
|
|
docker() {
|
|
if [[ "$1" == compose && "$2" == up ]]; then
|
|
printf 'compose-up\n' >> "$DOCKER_TEST_LOG"
|
|
return 0
|
|
fi
|
|
|
|
if [[ "$1" == compose && "$2" == ps ]]; then
|
|
printf 'floci-container\n'
|
|
return 0
|
|
fi
|
|
|
|
if [[ "$1" == inspect ]]; then
|
|
printf '172.20.0.2\n'
|
|
return 0
|
|
fi
|
|
|
|
if [[ "$1" == build ]]; then
|
|
suite="${!#}"
|
|
suite="${suite#compatibility-tests/}"
|
|
printf 'build:%s\n' "$suite" >> "$DOCKER_TEST_LOG"
|
|
[[ "$suite" != "$FAIL_BUILD_SUITE" ]]
|
|
return
|
|
fi
|
|
|
|
if [[ "$1" == run ]]; then
|
|
suite="${!#}"
|
|
suite="${suite#compat-}"
|
|
printf 'run:%s\n' "$suite" >> "$DOCKER_TEST_LOG"
|
|
[[ "$suite" != "$FAIL_RUN_SUITE" ]]
|
|
return
|
|
fi
|
|
|
|
printf 'unexpected docker command: %s\n' "$*" >&2
|
|
return 1
|
|
}
|
|
|
|
curl() {
|
|
return 0
|
|
}
|
|
|
|
export -f docker curl
|
|
|
|
if bash "$REPO_ROOT/docker/run-docker-tests.sh"; then
|
|
status=0
|
|
else
|
|
status=$?
|
|
fi
|
|
|
|
if [[ "$status" -eq 0 ]]; then
|
|
echo "expected a failed suite to produce a non-zero exit status" >&2
|
|
exit 1
|
|
fi
|
|
|
|
expected_suites=(
|
|
sdk-test-python
|
|
sdk-test-node
|
|
sdk-test-java
|
|
sdk-test-go
|
|
sdk-test-awscli
|
|
compat-cdk
|
|
compat-terraform
|
|
compat-opentofu
|
|
)
|
|
|
|
for suite in "${expected_suites[@]}"; do
|
|
grep -qx "run:$suite" "$LOG_FILE" || {
|
|
echo "expected suite to run after failure: $suite" >&2
|
|
exit 1
|
|
}
|
|
done
|
|
|
|
: > "$LOG_FILE"
|
|
export FAIL_RUN_SUITE=
|
|
|
|
bash "$REPO_ROOT/docker/run-docker-tests.sh" || {
|
|
echo "expected all successful suites to produce a zero exit status" >&2
|
|
exit 1
|
|
}
|
|
|
|
: > "$LOG_FILE"
|
|
export FAIL_BUILD_SUITE=compat-cdk
|
|
|
|
if bash "$REPO_ROOT/docker/run-docker-tests.sh"; then
|
|
status=0
|
|
else
|
|
status=$?
|
|
fi
|
|
|
|
if [[ "$status" -eq 0 ]]; then
|
|
echo "expected a failed image build to produce a non-zero exit status" >&2
|
|
exit 1
|
|
fi
|
|
|
|
for suite in "${expected_suites[@]}"; do
|
|
if [[ "$suite" == "compat-cdk" ]]; then
|
|
grep -q "run:$suite" "$LOG_FILE" && {
|
|
echo "failed image build should not run suite: $suite" >&2
|
|
exit 1
|
|
}
|
|
continue
|
|
fi
|
|
grep -q "run:$suite" "$LOG_FILE" || {
|
|
echo "expected suite to run after failed image build: $suite" >&2
|
|
exit 1
|
|
}
|
|
done
|
|
|
|
# A subset with FLOCI_START=0 runs only the named suites and never starts compose.
|
|
: > "$LOG_FILE"
|
|
export FAIL_BUILD_SUITE=
|
|
|
|
FLOCI_START=0 COMPAT_SUITES="sdk-test-java compat-cdk" bash "$REPO_ROOT/docker/run-docker-tests.sh" || {
|
|
echo "expected the selected suites to pass" >&2
|
|
exit 1
|
|
}
|
|
|
|
grep -q "compose-up" "$LOG_FILE" && {
|
|
echo "FLOCI_START=0 must not start compose" >&2
|
|
exit 1
|
|
}
|
|
for suite in sdk-test-java compat-cdk; do
|
|
grep -qx "run:$suite" "$LOG_FILE" || {
|
|
echo "expected selected suite to run: $suite" >&2
|
|
exit 1
|
|
}
|
|
done
|
|
for suite in sdk-test-python sdk-test-node sdk-test-go sdk-test-awscli compat-terraform compat-opentofu; do
|
|
grep -q "run:$suite" "$LOG_FILE" && {
|
|
echo "unselected suite must not run: $suite" >&2
|
|
exit 1
|
|
}
|
|
done
|
|
|
|
# An unknown suite name is refused before anything runs.
|
|
: > "$LOG_FILE"
|
|
if COMPAT_SUITES="sdk-test-rust" bash "$REPO_ROOT/docker/run-docker-tests.sh" 2>/dev/null; then
|
|
echo "expected an unknown suite name to be refused" >&2
|
|
exit 1
|
|
fi
|
|
grep -q "run:" "$LOG_FILE" && {
|
|
echo "an unknown suite name must not run anything" >&2
|
|
exit 1
|
|
}
|
|
|
|
echo "run-docker-tests.sh: all checks passed"
|