Add rail-kubernetes compatibility shim
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 2s

This commit is contained in:
codex 2026-07-26 02:21:19 +02:00
parent 494a599f16
commit c6f4ab536f
6 changed files with 128 additions and 24 deletions

View file

@ -5,6 +5,53 @@ set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
PATH="${ROOT}/tools/cmd:${PATH}"
resolve_rail_kubernetes_bin() {
if [[ -n "${RAILIANCE_RAIL_KUBERNETES_BIN:-}" ]]; then
if [[ -x "${RAILIANCE_RAIL_KUBERNETES_BIN}" ]]; then
printf '%s\n' "${RAILIANCE_RAIL_KUBERNETES_BIN}"
return 0
fi
echo "ERROR: RAILIANCE_RAIL_KUBERNETES_BIN is not executable: ${RAILIANCE_RAIL_KUBERNETES_BIN}" >&2
return 2
fi
local sibling="${ROOT}/../rail-kubernetes/bin/railiance"
if [[ -x "${sibling}" ]]; then
printf '%s\n' "${sibling}"
return 0
fi
return 1
}
run_compat_command() {
local cmd="$1"
shift || true
local delegate_bin=""
local resolve_status=0
if delegate_bin="$(resolve_rail_kubernetes_bin)"; then
exec "${delegate_bin}" "${cmd}" "$@"
else
resolve_status=$?
fi
if [[ "${resolve_status}" -eq 2 ]]; then
exit 1
fi
echo "WARN: rail-kubernetes delegate not found; using compatibility implementation from railiance-cluster" >&2
case "${cmd}" in
create-overlay) bash "$ROOT/tools/create_railiance_overlay_repo.sh" "$@" ;;
run) exec railiance-run "$@" ;;
deploy) exec railiance-stage2 deploy "$@" ;;
observe) exec railiance-stage2 observe "$@" ;;
promote) exec railiance-stage3 promote "$@" ;;
rollback) exec railiance-stage3 rollback "$@" ;;
*) echo "Unknown compatibility command: ${cmd}" >&2; exit 2 ;;
esac
}
usage() {
cat <<'EOF'
Usage: bin/railiance <command> [args]
@ -16,12 +63,12 @@ Commands:
gen-ssh-key Generate SSH key and show public part
cloudinit Emit minimal cloud-init user-data
init-repo Idempotently furnish repo housekeeping
create-overlay Scaffold a Railiance overlay repo for an upstream app
run Run Stage 1 local validation from railiance/app.toml
deploy Plan/apply Stage 2 canary deployment
observe Plan/run Stage 2 observation checks
promote Plan/apply Stage 3 stable promotion
rollback Plan/apply rollback to previous stable
create-overlay Delegate to rail-kubernetes or use local compatibility scaffold
run Delegate to rail-kubernetes or run local Stage 1 compatibility path
deploy Delegate to rail-kubernetes or run local Stage 2 compatibility path
observe Delegate to rail-kubernetes or run local Stage 2 compatibility path
promote Delegate to rail-kubernetes or run local Stage 3 compatibility path
rollback Delegate to rail-kubernetes or run local Stage 3 compatibility path
deploy-triage-robustness
Deploy ACTIVITY-WP-0016 and prove daily-triage validation
admin-sync-smoke
@ -49,12 +96,12 @@ case "$cmd" in
;;
cloudinit) cat "$ROOT/cloudinit/user-data.yaml" ;;
init-repo) bash "$ROOT/tools/furnish_railiance_repo.sh" ;;
create-overlay) bash "$ROOT/tools/create_railiance_overlay_repo.sh" "$@" ;;
run) exec railiance-run "$@" ;;
deploy) exec railiance-stage2 deploy "$@" ;;
observe) exec railiance-stage2 observe "$@" ;;
promote) exec railiance-stage3 promote "$@" ;;
rollback) exec railiance-stage3 rollback "$@" ;;
create-overlay) run_compat_command create-overlay "$@" ;;
run) run_compat_command run "$@" ;;
deploy) run_compat_command deploy "$@" ;;
observe) run_compat_command observe "$@" ;;
promote) run_compat_command promote "$@" ;;
rollback) run_compat_command rollback "$@" ;;
deploy-triage-robustness) exec railiance-deploy-activity-core-triage-robustness "$@" ;;
admin-sync-smoke) exec railiance-admin-sync-smoke "$@" ;;
build-spore) bash "$ROOT/tools/build_spore.sh" ;;