Fix python script

This commit is contained in:
dvirlabs 2025-06-26 02:20:57 +03:00
parent c94377d6bc
commit 151285b757
2 changed files with 7 additions and 9 deletions

View File

@ -9,7 +9,7 @@ REPOS = {
}
TMP_DIR = ".tmp-repos"
OUTPUT_FILE = ".tmp-repos/observability-stack/manifests/prometheus-scrape-secret/additional-scrape-configs.yaml"
OUTPUT_FILE = os.path.join(TMP_DIR, "observability-stack/manifests/prometheus-scrape-secret/additional-scrape-configs.yaml")
os.makedirs(TMP_DIR, exist_ok=True)
@ -37,11 +37,11 @@ def write_scrape_config(jobs):
for repo, targets in jobs.items():
result.append({
"job_name": repo,
"static_configs": [
{"targets": targets}
]
"static_configs": [{"targets": targets}]
})
scrape_yaml = "# This content will be auto-updated by the pipeline\n" + yaml.dump(result, sort_keys=False)
secret = {
"apiVersion": "v1",
"kind": "Secret",
@ -54,13 +54,13 @@ def write_scrape_config(jobs):
},
"type": "Opaque",
"stringData": {
"additional-scrape-configs.yaml": "# This content will be auto-updated by the pipeline\n" + yaml.dump(result)
"additional-scrape-configs.yaml": scrape_yaml
}
}
os.makedirs(os.path.dirname(OUTPUT_FILE), exist_ok=True)
with open(OUTPUT_FILE, "w") as f:
yaml.dump(secret, f)
yaml.dump(secret, f, sort_keys=False)
if __name__ == "__main__":
jobs = collect_targets()

View File

@ -23,6 +23,4 @@ else
git add manifests/prometheus-scrape-secret/additional-scrape-configs.yaml
git commit -m "auto: update Prometheus scrape config"
git push origin master
fi
cat .tmp-repos/observability-stack/manifests/prometheus-scrape-secret/additional-scrape-configs.yaml
fi