]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
fixing --no-artifacts in git-check-tag-ci 315-artifacts
authorMaria Matejka <mq@ucw.cz>
Mon, 26 Jan 2026 17:30:28 +0000 (18:30 +0100)
committerMaria Matejka <mq@ucw.cz>
Mon, 26 Jan 2026 17:30:28 +0000 (18:30 +0100)
tools/git-check-tag-ci

index 0b7a442710617972ec75d019b3730e8f2eb57adf..5a898bf602061433c8f1d9973d3815c49b48c7bb 100755 (executable)
@@ -6,6 +6,9 @@ import requests
 import sys
 import zipfile
 
+artifacts = (sys.argv[1] != "--no-artifacts")
+ref = sys.argv[1] if artifacts else sys.argv[2]
+
 def load_api_request(name, query):
     timeout = 5
     while True:
@@ -45,7 +48,7 @@ def load_pipelines(sha):
 def load_jobs(pipeline):
     return load_paginated("jobs", f"/pipelines/{pipeline}/jobs/")
 
-for p in load_pipelines(sys.argv[1]):
+for p in load_pipelines(ref):
     if p['status'] in ("failed", "cancelled"):
         print(f"Pipeline {p['id']} {p['status']} at {p['web_url']}")
         failed = [ job for job in load_jobs(p['id']) if job['status'] == "failed" ]
@@ -81,9 +84,12 @@ for p in load_pipelines(sys.argv[1]):
                 print(f"\t{ job['name'] }:")
             for f in job['artifacts']:
                 if f['file_type'] == 'archive':
-                    with zipfile.ZipFile(io.BytesIO(load_api_request("metadata", f"/jobs/{job['id']}/artifacts/"))) as z:
-                        z.extractall()
+                    if artifacts:
+                        with zipfile.ZipFile(io.BytesIO(load_api_request("metadata", f"/jobs/{job['id']}/artifacts/"))) as z:
+                            z.extractall()
+                    else:
+                        print("\t\thas artifacts")
         exit(0)
 
-print("No suitable pipeline found, tag not OK")
+print(f"No suitable pipeline found for { ref }, tag not OK")
 exit(1)