mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
chore(release): publish standalone floci-aws binaries as release assets (#5844)
* chore(release): publish standalone floci-aws binaries as release assets The release already built Linux native executables, but only to package them into the images; they were discarded after a day and releases carried no assets. Users without Docker had nothing to download. release.yml now also builds macOS (arm64, and x86_64 under Rosetta) and Windows x86_64 binaries with GraalVM Community, smoke-tests every binary on its own runner with .github/scripts/smoke-binary.sh (version matches the tag, SQS and DynamoDB round trips, clean stop on SIGTERM), and checks that the Linux amd64 binary still starts on glibc 2.34 (Ubuntu 22.04). A new publish-binaries job, the only one with write access to the release, stages the six executables as floci-aws-<os>-<arch>, writes sha256sums.txt, signs every file with keyless cosign sign-blob, attests build provenance, and uploads them to the release semantic-release created. Build artifacts are kept 7 days so that job can be re-run on its own. make native-install now installs floci-aws, since floci is the CLI. Refs #5767 Signed-off-by: Hector Ventura <hectorvent@gmail.com> * fix(release): check the glibc 2.34 floor on every Linux binary and wait for the release Review follow-ups for the binary release jobs: - The floor check started the amd64 binary on Ubuntu 22.04, whose glibc is 2.35, so a binary that needed 2.35 would have passed. check-glibc-floor.sh now reads the newest GLIBC_ symbol version the binary requires with readelf and fails above 2.34, then starts it in UBI 9, whose glibc is 2.34. - The two arm64 builds had no floor check at all; they run the same script. - publish-binaries waits up to 10 minutes for semantic-release to create the GitHub Release before uploading, instead of failing if it is not there yet. Signed-off-by: Hector Ventura <hectorvent@gmail.com> * fix(release): build darwin-amd64 with a pinned, checksummed GraalVM Community The macOS x86_64 job downloaded Oracle GraalVM from download.oracle.com's "latest" URL: not the Community build the job's comment names, unpinned and unchecked, though its output is then signed and attested as ours. It now fetches GraalVM Community 25.0.1, the last release with a macOS x64 build, from graalvm-ce-builds and checks it against the published SHA-256 before extracting it. The publish-binaries header said semantic-release creates the release before pushing the tag; it pushes the tag first, as the upload step says. Signed-off-by: Hector Ventura <hectorvent@gmail.com> --------- Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
1 parent
043daa5da6
commit
5370920012
5 files changed
+385
-8
No files matched your search
Executable
+121
@@ -0,0 +1,121 @@
|
||||
#!/usr/bin/env bash
|
||||
# Smoke-tests one standalone floci-aws binary before it is published.
|
||||
#
|
||||
# smoke-binary.sh <binary> <expected-version>
|
||||
#
|
||||
# Starts the binary on a free port with in-memory storage and a scratch data
|
||||
# directory, then checks that:
|
||||
# 1. /_floci/health answers and reports <expected-version> (never "dev"),
|
||||
# 2. SQS and DynamoDB round-trip through the AWS CLI (no Docker needed),
|
||||
# 3. SIGTERM stops it cleanly within the grace period (skipped on Windows,
|
||||
# where Git Bash cannot deliver a console signal to a native process).
|
||||
# Requires bash, curl, Python and the AWS CLI. Exits non-zero on the first failure.
|
||||
set -euo pipefail
|
||||
|
||||
BIN=${1:?usage: smoke-binary.sh <binary> <expected-version>}
|
||||
EXPECTED=${2:?usage: smoke-binary.sh <binary> <expected-version>}
|
||||
GRACE_SECONDS=${SMOKE_GRACE_SECONDS:-30}
|
||||
|
||||
case "$(uname -s)" in
|
||||
MINGW*|MSYS*|CYGWIN*) WINDOWS=true ;;
|
||||
*) WINDOWS=false ;;
|
||||
esac
|
||||
|
||||
# Windows runners ship python, not python3.
|
||||
PYTHON=$(command -v python3 || command -v python)
|
||||
|
||||
free_port() {
|
||||
"$PYTHON" -c 'import socket; s=socket.socket(); s.bind(("127.0.0.1", 0)); print(s.getsockname()[1]); s.close()'
|
||||
}
|
||||
|
||||
PORT=${SMOKE_PORT:-$(free_port)}
|
||||
WORK=$(mktemp -d)
|
||||
LOG="$WORK/floci.log"
|
||||
ENDPOINT="http://127.0.0.1:$PORT"
|
||||
PID=""
|
||||
|
||||
cleanup() {
|
||||
if [ -n "$PID" ] && kill -0 "$PID" 2>/dev/null; then
|
||||
kill -9 "$PID" 2>/dev/null || true
|
||||
fi
|
||||
rm -rf "$WORK"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
fail() {
|
||||
echo "FAIL: $*" >&2
|
||||
echo "--- floci log (last 60 lines) ---" >&2
|
||||
tail -n 60 "$LOG" >&2 || true
|
||||
exit 1
|
||||
}
|
||||
|
||||
aws_local() {
|
||||
AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test AWS_DEFAULT_REGION=us-east-1 AWS_PAGER="" \
|
||||
aws --endpoint-url "$ENDPOINT" "$@"
|
||||
}
|
||||
|
||||
chmod +x "$BIN" 2>/dev/null || true
|
||||
echo "smoke: $BIN on port $PORT, expecting version $EXPECTED"
|
||||
|
||||
FLOCI_STORAGE_MODE=memory \
|
||||
FLOCI_STORAGE_PERSISTENT_PATH="$WORK/data" \
|
||||
FLOCI_PORT="$PORT" \
|
||||
QUARKUS_HTTP_PORT="$PORT" \
|
||||
"$BIN" > "$LOG" 2>&1 &
|
||||
PID=$!
|
||||
|
||||
for _ in $(seq 1 120); do
|
||||
if curl -sf "$ENDPOINT/_floci/health" > "$WORK/health.json" 2>/dev/null; then
|
||||
break
|
||||
fi
|
||||
kill -0 "$PID" 2>/dev/null || fail "the binary exited before answering /_floci/health"
|
||||
sleep 0.5
|
||||
done
|
||||
[ -s "$WORK/health.json" ] || fail "/_floci/health did not answer within 60s"
|
||||
|
||||
VERSION=$("$PYTHON" -c 'import json,sys; print(json.load(open(sys.argv[1]))["version"])' "$WORK/health.json")
|
||||
[ "$VERSION" = "$EXPECTED" ] || fail "/_floci/health reports version '$VERSION', expected '$EXPECTED'"
|
||||
echo "ok: version $VERSION"
|
||||
|
||||
QUEUE_URL=$(aws_local sqs create-queue --queue-name smoke --query QueueUrl --output text) \
|
||||
|| fail "sqs create-queue"
|
||||
aws_local sqs send-message --queue-url "$QUEUE_URL" --message-body hello > /dev/null || fail "sqs send-message"
|
||||
BODY=$(aws_local sqs receive-message --queue-url "$QUEUE_URL" --query 'Messages[0].Body' --output text) \
|
||||
|| fail "sqs receive-message"
|
||||
[ "$BODY" = "hello" ] || fail "sqs round trip returned '$BODY'"
|
||||
echo "ok: sqs"
|
||||
|
||||
aws_local dynamodb create-table --table-name smoke --billing-mode PAY_PER_REQUEST \
|
||||
--attribute-definitions AttributeName=id,AttributeType=S --key-schema AttributeName=id,KeyType=HASH \
|
||||
> /dev/null || fail "dynamodb create-table"
|
||||
aws_local dynamodb put-item --table-name smoke --item '{"id":{"S":"1"},"v":{"S":"world"}}' || fail "dynamodb put-item"
|
||||
VALUE=$(aws_local dynamodb get-item --table-name smoke --key '{"id":{"S":"1"}}' --query 'Item.v.S' --output text) \
|
||||
|| fail "dynamodb get-item"
|
||||
[ "$VALUE" = "world" ] || fail "dynamodb round trip returned '$VALUE'"
|
||||
echo "ok: dynamodb"
|
||||
|
||||
if [ "$WINDOWS" = true ]; then
|
||||
echo "skip: graceful-shutdown check on Windows"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
kill -TERM "$PID"
|
||||
for _ in $(seq 1 $((GRACE_SECONDS * 2))); do
|
||||
kill -0 "$PID" 2>/dev/null || break
|
||||
sleep 0.5
|
||||
done
|
||||
if kill -0 "$PID" 2>/dev/null; then
|
||||
fail "still running ${GRACE_SECONDS}s after SIGTERM"
|
||||
fi
|
||||
set +e
|
||||
wait "$PID"
|
||||
STATUS=$?
|
||||
set -e
|
||||
PID=""
|
||||
# A JVM-style exit on SIGTERM is 143 (128 + 15); Quarkus exits 0 after a clean shutdown.
|
||||
case "$STATUS" in
|
||||
0|143) echo "ok: stopped on SIGTERM (exit $STATUS)" ;;
|
||||
*) fail "exit status $STATUS after SIGTERM" ;;
|
||||
esac
|
||||
grep -q "stopped in" "$LOG" || fail "no Quarkus 'stopped in' line after SIGTERM"
|
||||
echo "smoke passed: $BIN"
|
||||
Reference in new issue
Block a user