diff --git a/automation/scrape-sync.sh b/automation/scrape-sync.sh new file mode 100644 index 0000000..d3a99aa --- /dev/null +++ b/automation/scrape-sync.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -e + +echo "🔄 Cloning repositories..." +REPOS=("dev-tools" "infra" "observability-stack") +rm -rf .tmp-repos +mkdir -p .tmp-repos + +for REPO in "${REPOS[@]}"; do + git clone https://${GIT_TOKEN}@git.dvirlabs.com/dvirlabs/${REPO}.git .tmp-repos/${REPO} +done + +echo "⚙️ Generating additional-scrape-configs.yaml..." +python3 automation/generate-scrape-config.py + +echo "📦 Copying into observability-stack repo..." +cp observability-stack/manifests/prometheus-scrape-secret/additional-scrape-configs.yaml .tmp-repos/observability-stack/manifests/prometheus-scrape-secret/ + +cd .tmp-repos/observability-stack +git config user.name "auto-sync" +git config user.email "sync@dvirlabs.com" + +if git diff --quiet; then + echo "✅ No changes to commit." +else + git add manifests/prometheus-scrape-secret/additional-scrape-configs.yaml + git commit -m "auto: update Prometheus scrape config" + git push origin master +fi