Debug
This commit is contained in:
parent
00dc7c0f10
commit
f95a7075c7
@ -1,5 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import yaml
|
import yaml
|
||||||
|
import glob
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
# 🔁 Repos to scan for monitoring.yaml files
|
# 🔁 Repos to scan for monitoring.yaml files
|
||||||
@ -34,10 +35,8 @@ def extract_urls():
|
|||||||
manifests_path = os.path.join(BASE_DIR, repo, "manifests")
|
manifests_path = os.path.join(BASE_DIR, repo, "manifests")
|
||||||
if not os.path.isdir(manifests_path):
|
if not os.path.isdir(manifests_path):
|
||||||
continue
|
continue
|
||||||
for app in os.listdir(manifests_path):
|
# recursively find all monitoring.yaml
|
||||||
path = os.path.join(manifests_path, app, "monitoring.yaml")
|
for path in glob.glob(f"{manifests_path}/**/monitoring.yaml", recursive=True):
|
||||||
if not os.path.exists(path):
|
|
||||||
continue
|
|
||||||
with open(path) as f:
|
with open(path) as f:
|
||||||
cfg = yaml.safe_load(f)
|
cfg = yaml.safe_load(f)
|
||||||
if not cfg.get("enabled"):
|
if not cfg.get("enabled"):
|
||||||
@ -45,7 +44,7 @@ def extract_urls():
|
|||||||
ext = cfg.get("external_check")
|
ext = cfg.get("external_check")
|
||||||
if not ext or not ext.get("url"):
|
if not ext or not ext.get("url"):
|
||||||
continue
|
continue
|
||||||
app_name = cfg.get("app", app)
|
app_name = cfg.get("app") or os.path.basename(os.path.dirname(path))
|
||||||
urls.append({
|
urls.append({
|
||||||
"name": app_name,
|
"name": app_name,
|
||||||
"url": ext["url"]
|
"url": ext["url"]
|
||||||
@ -53,6 +52,7 @@ def extract_urls():
|
|||||||
return urls
|
return urls
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def generate_workflow(urls):
|
def generate_workflow(urls):
|
||||||
os.makedirs(os.path.dirname(WORKFLOW_FILE), exist_ok=True)
|
os.makedirs(os.path.dirname(WORKFLOW_FILE), exist_ok=True)
|
||||||
with open(WORKFLOW_FILE, "w") as f:
|
with open(WORKFLOW_FILE, "w") as f:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user