OPA/Rego deployment gateway policies: 5 rules (valid-environment, require-approvals, no-self-approval, block-weekends, freeze-window), a deploy-gate combining them, JSON schemas, scenario-driven tests, Gitea Actions CI (verify + publish to generic registry), changesets versioning, Makefile and scripts.
28 lines
723 B
Bash
Executable File
28 lines
723 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Installs a pinned OPA release binary into tools/opa.
|
|
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
TOOLS_DIR="$ROOT_DIR/tools"
|
|
OPA_VERSION="${OPA_VERSION:-1.20.2}"
|
|
|
|
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
|
ARCH="$(uname -m)"
|
|
case "$ARCH" in
|
|
x86_64) ARCH="amd64" ;;
|
|
arm64) ARCH="arm64" ;;
|
|
esac
|
|
|
|
URL="https://openpolicyagent.org/downloads/v${OPA_VERSION}/opa_${OS}_${ARCH}_static"
|
|
|
|
mkdir -p "$TOOLS_DIR"
|
|
if command -v curl >/dev/null 2>&1; then
|
|
curl -fsSL "$URL" -o "$TOOLS_DIR/opa"
|
|
else
|
|
wget -qO "$TOOLS_DIR/opa" "$URL"
|
|
fi
|
|
chmod +x "$TOOLS_DIR/opa"
|
|
|
|
echo "Installed OPA v${OPA_VERSION} (${OS}/${ARCH}) to $TOOLS_DIR/opa"
|
|
"$TOOLS_DIR/opa" version | head -1 |