This repository has been archived on 2026-07-10. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
authentik/scripts/lib/sops-path-regexes
T
olb042 c85556e327
Validate manifests / validate (push) Failing after 8s
Initial authentik gitops app
2026-04-20 01:03:25 +01:00

39 lines
830 B
Bash
Executable File

#!/usr/bin/env zsh
set -eu
repo_root=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
sops_file="${repo_root}/.sops.yaml"
if [ ! -f "${sops_file}" ]; then
exit 0
fi
if command -v yq >/dev/null 2>&1; then
yq -r '.creation_rules[]?.path_regex | select(. != null)' "${sops_file}"
exit 0
fi
if command -v python3 >/dev/null 2>&1; then
python3 - "${sops_file}" <<'PY'
import sys
try:
import yaml
except Exception as exc:
raise SystemExit(f"python3 fallback requires PyYAML: {exc}")
with open(sys.argv[1], "r", encoding="utf-8") as handle:
data = yaml.safe_load(handle) or {}
for rule in data.get("creation_rules") or []:
regex = rule.get("path_regex")
if regex:
print(regex)
PY
exit 0
fi
echo "Unable to read .sops.yaml path_regex values: install yq or python3 with PyYAML" >&2
exit 1