]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CI: more granular failure on generating build matrix
authorIlya Shipitsin <chipitsine@gmail.com>
Wed, 26 Apr 2023 18:39:39 +0000 (20:39 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 8 May 2023 12:05:44 +0000 (14:05 +0200)
when some api endpoints used for determine latest OpenSSL, LibreSSL
are unavailable, fail only those builds, not entire matrix

.github/matrix.py

index a2a02e9684dd88680dbeee092f16a62ad7083eb0..7f22c43bb20a56c67abee699b399229dc79cb7ea 100755 (executable)
@@ -33,11 +33,13 @@ def determine_latest_openssl(ssl):
     headers = {}
     if environ.get("GITHUB_TOKEN") is not None:
         headers["Authorization"] = "token {}".format(environ.get("GITHUB_TOKEN"))
-
     request = urllib.request.Request(
         "https://api.github.com/repos/openssl/openssl/tags", headers=headers
     )
-    openssl_tags = urllib.request.urlopen(request)
+    try:
+      openssl_tags = urllib.request.urlopen(request)
+    except:
+      return "OPENSSL_VERSION=failed_to_detect"
     tags = json.loads(openssl_tags.read().decode("utf-8"))
     latest_tag = ""
     for tag in tags:
@@ -50,9 +52,12 @@ def determine_latest_openssl(ssl):
 
 @functools.lru_cache(5)
 def determine_latest_libressl(ssl):
-    libressl_download_list = urllib.request.urlopen(
-        "https://cdn.openbsd.org/pub/OpenBSD/LibreSSL/"
-    )
+    try:
+      libressl_download_list = urllib.request.urlopen(
+          "https://cdn.openbsd.org/pub/OpenBSD/LibreSSL/"
+      )
+    except:
+      return "LIBRESSL_VERSION=failed_to_detect"
     for line in libressl_download_list.readlines():
         decoded_line = line.decode("utf-8")
         if "libressl-" in decoded_line and ".tar.gz.asc" in decoded_line: