jecio/run-projector-standard.sh

68 lines
1.7 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -euo pipefail
# Canonical projector command for lakehouse-core.
# Usage:
# ./run-projector-standard.sh # publish (both targets)
# ./run-projector-standard.sh --dry-run # validate only
# ./run-projector-standard.sh --targets es # ES-only publish
# ./run-projector-standard.sh --release-name rel_2026-02-14_docs-v1
MANIFEST_FILE="${MANIFEST_FILE:-./manifests/rel_2026-02-14_docs-v1.json}"
CONCEPT_TABLE="${CONCEPT_TABLE:-lake.db1.docs}"
TARGETS="${TARGETS:-both}"
RELEASE_NAME="${RELEASE_NAME:-}"
MODE=""
while [[ $# -gt 0 ]]; do
case "$1" in
--dry-run)
MODE="--dry-run"
shift
;;
--targets)
TARGETS="${2:-}"
if [[ -z "$TARGETS" ]]; then
echo "--targets requires one of: es|gremlin|both" >&2
exit 1
fi
shift 2
;;
--manifest-file)
MANIFEST_FILE="${2:-}"
if [[ -z "$MANIFEST_FILE" ]]; then
echo "--manifest-file requires a value" >&2
exit 1
fi
shift 2
;;
--release-name)
RELEASE_NAME="${2:-}"
if [[ -z "$RELEASE_NAME" ]]; then
echo "--release-name requires a value" >&2
exit 1
fi
shift 2
;;
--concept-table)
CONCEPT_TABLE="${2:-}"
if [[ -z "$CONCEPT_TABLE" ]]; then
echo "--concept-table requires a value" >&2
exit 1
fi
shift 2
;;
*)
echo "Unknown argument: $1" >&2
exit 1
;;
esac
done
if [[ "$TARGETS" != "es" && "$TARGETS" != "gremlin" && "$TARGETS" != "both" ]]; then
echo "Invalid --targets value: $TARGETS (expected es|gremlin|both)" >&2
exit 1
fi
./run-projector-via-spark-container.sh "$MANIFEST_FILE" "$CONCEPT_TABLE" "$MODE" "$TARGETS" "$RELEASE_NAME"