#!/usr/bin/env bash # OMNL operator rail CI: .gitignore check, shellcheck on scripts (if available), resolve_ids parse check. # Usage: from repo root. Exit 0 if all pass. set -euo pipefail REPO_ROOT="${REPO_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}" cd "$REPO_ROOT" fail=0 # 1) .gitignore must include ids.env and reconciliation/ if ! grep -q 'ids\.env' .gitignore 2>/dev/null; then echo "FAIL: .gitignore missing ids.env" >&2 fail=1 fi if ! grep -q 'reconciliation' .gitignore 2>/dev/null; then echo "FAIL: .gitignore missing reconciliation/" >&2 fail=1 fi [ $fail -eq 0 ] && echo "PASS: .gitignore has ids.env and reconciliation/" >&2 # 2) resolve_ids.sh must handle both array and pageItems (grep for pattern) if ! grep -q 'pageItems' scripts/omnl/resolve_ids.sh 2>/dev/null; then echo "WARN: resolve_ids.sh may not handle pageItems response" >&2 fi if ! grep -q 'if type == "array"' scripts/omnl/resolve_ids.sh 2>/dev/null; then echo "WARN: resolve_ids.sh may not normalize array" >&2 fi # 3) Shellcheck (optional) if command -v shellcheck >/dev/null 2>&1; then for f in scripts/omnl/*.sh; do [ -f "$f" ] && shellcheck -x "$f" 2>/dev/null || true done echo "PASS: shellcheck completed" >&2 else echo "SKIP: shellcheck not installed" >&2 fi if command -v python3 >/dev/null 2>&1; then python3 -m py_compile \ scripts/omnl/generate-transaction-package-evidence.py \ scripts/omnl/verify-transaction-package-commitment.py 2>/dev/null \ && echo "PASS: py_compile transaction-package scripts" >&2 \ || { echo "FAIL: py_compile transaction-package scripts" >&2; fail=1; } else echo "SKIP: python3 not installed" >&2 fi for sh in \ scripts/omnl/build-transaction-package-zip.sh \ scripts/omnl/patch-attestation-subreg-pdf-hashes.sh \ scripts/omnl/apply-qes-tsa-to-staging.sh \ scripts/omnl/check-transaction-package-4995-readiness.sh \ scripts/omnl/omnl-transaction-package-snapshot.sh \ scripts/omnl/omnl-pvp-post-clearing-bank-kanaya.sh \ scripts/omnl/omnl-office-create-bank-kanaya.sh \ scripts/omnl/run-transaction-package-ci-smoke.sh do if [ -f "$sh" ]; then bash -n "$sh" 2>/dev/null && echo "PASS: bash -n $sh" >&2 || { echo "FAIL: bash -n $sh" >&2; fail=1; } fi done exit $fail