summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2022-08-02 10:41:34 +0300
committerLars Wirzenius <liw@liw.fi>2022-08-02 10:41:34 +0300
commitbd1aa69b5ab5de4a21924db55f8206ad89950d55 (patch)
tree1ddc02c2e72745199250865a8844f18383cae664
parent536ca15b718e36d69913d70799134c285676ffcd (diff)
downloadliw-ci-bd1aa69b5ab5de4a21924db55f8206ad89950d55.tar.gz
add script to list projects with missing or old builds
Sponsored-by: author
-rwxr-xr-xtrigger-old46
1 files changed, 46 insertions, 0 deletions
diff --git a/trigger-old b/trigger-old
new file mode 100755
index 0000000..5e872c3
--- /dev/null
+++ b/trigger-old
@@ -0,0 +1,46 @@
+#!/usr/bin/python3
+
+import json
+import re
+import subprocess
+import time
+
+
+def get_projects():
+ o = subprocess.run(
+ ["icktool", "show", "/projects"], check=True, capture_output=True
+ )
+ projects = json.loads(o.stdout)
+ return [
+ p["project"]
+ for p in projects["projects"]
+ if not p["project"].startswith("dummy")
+ ]
+
+
+def get_latest_build_log(project):
+ o = subprocess.run(
+ ["icktool", "show-latest-log", project], check=True, capture_output=True
+ )
+ return o.stdout.decode()
+
+
+pat = re.compile(r"^Build starts at (?P<timestamp>\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d)")
+
+
+def log_timestamp(log):
+ m = pat.match(log)
+ if m is None:
+ return None
+ return m["timestamp"]
+
+
+day = 24 * 60 * 60
+cutoff = time.localtime(time.time() - day * 7)
+new_enough = time.strftime("%Y-%m-%d %H:%M:%S", cutoff)
+
+for project in sorted(get_projects()):
+ log = get_latest_build_log(project)
+ ts = log_timestamp(log)
+ if ts is None or ts < new_enough:
+ print(project)