CI: more granular failure on generating build matrix

when some api endpoints used for determine latest OpenSSL, LibreSSL
are unavailable, fail only those builds, not entire matrix
This commit is contained in:
Ilya Shipitsin 2023-04-26 20:39:39 +02:00 committed by Willy Tarreau
parent 652d1712dd
commit ed79a27a91
1 changed files with 10 additions and 5 deletions

15
.github/matrix.py vendored
View File

@ -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: