mirror of
https://codeberg.org/Toasterson/solstice-ci.git
synced 2026-04-10 13:20:41 +00:00
This commit introduces: - Flexible runner URL configuration via `SOLSTICE_RUNNER_URL(S)` for cloud-init. - Automated detection of OS-specific runner binaries during VM boot. - Tasks for cross-building, serving, and orchestrating Solstice runners. - End-to-end VM build flows for Linux and Illumos environments. - Enhanced orchestration with multi-runner HTTP serving and log streaming.
44 lines
No EOL
1.5 KiB
Bash
Executable file
44 lines
No EOL
1.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
# Serve the built workflow-runner binary over HTTP for local VMs to download.
|
|
# This is intended for local development only.
|
|
#
|
|
# Env:
|
|
# SOL_RUNNER_PORT - port to bind (default: 8089)
|
|
# SOL_RUNNER_BIND - bind address (default: 0.0.0.0)
|
|
# SOL_RUNNER_BINARY - path to runner binary (default: target/debug/solstice-runner)
|
|
#
|
|
# The file will be exposed at http://HOST:PORT/solstice-runner
|
|
|
|
ROOT_DIR=$(cd "$(dirname "$0")/../../.." && pwd)
|
|
cd "$ROOT_DIR"
|
|
|
|
command -v cargo >/dev/null 2>&1 || { echo "cargo is required" >&2; exit 127; }
|
|
PYTHON=${PYTHON:-python3}
|
|
if ! command -v "$PYTHON" >/dev/null 2>&1; then
|
|
echo "python3 is required to run a simple HTTP server" >&2
|
|
exit 127
|
|
fi
|
|
|
|
# Build runner if not present
|
|
BINARY_DEFAULT="$ROOT_DIR/target/debug/solstice-runner"
|
|
export SOL_RUNNER_BINARY=${SOL_RUNNER_BINARY:-$BINARY_DEFAULT}
|
|
if [[ ! -x "$SOL_RUNNER_BINARY" ]]; then
|
|
cargo build -p workflow-runner >/dev/null
|
|
if [[ ! -x "$SOL_RUNNER_BINARY" ]]; then
|
|
echo "runner binary not found at $SOL_RUNNER_BINARY after build" >&2
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Prepare serve dir under target
|
|
SERVE_DIR="$ROOT_DIR/target/runner-serve"
|
|
mkdir -p "$SERVE_DIR"
|
|
cp -f "$SOL_RUNNER_BINARY" "$SERVE_DIR/solstice-runner"
|
|
chmod +x "$SERVE_DIR/solstice-runner" || true
|
|
|
|
PORT=${SOL_RUNNER_PORT:-8089}
|
|
BIND=${SOL_RUNNER_BIND:-0.0.0.0}
|
|
|
|
echo "Serving solstice-runner from $SERVE_DIR on http://$BIND:$PORT (Ctrl-C to stop)" >&2
|
|
exec "$PYTHON" -m http.server "$PORT" --bind "$BIND" --directory "$SERVE_DIR" |