Re: [PATCH] CI: determine actual OpenSSL version dynamically

2022-05-20 Thread Willy Tarreau
On Fri, May 20, 2022 at 11:10:28PM +0500,  ??? wrote:
> Hello,
> 
> another small improvement, this change introduce "OPENSSL_VERSION=latest"
> semantic.

Applied, thank you Ilya!
Willy



[PATCH] CI: determine actual OpenSSL version dynamically

2022-05-20 Thread Илья Шипицин
Hello,

another small improvement, this change introduce "OPENSSL_VERSION=latest"
semantic.

Ilya
From 0ba9b1a7791f8894b1d2061914f7e2b613785775 Mon Sep 17 00:00:00 2001
From: Ilya Shipitsin 
Date: Fri, 20 May 2022 23:02:38 +0500
Subject: [PATCH] CI: determine actual OpenSSL version dynamically

this change introduce "OPENSSL_VERSION=latest" semantic, which scans
https://api.github.com/repos/openssl/openssl/tags and detects latest release.
---
 .github/matrix.py | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/.github/matrix.py b/.github/matrix.py
index 5f7ea3c41..27f25ff7a 100755
--- a/.github/matrix.py
+++ b/.github/matrix.py
@@ -33,6 +33,17 @@ def clean_os(os):
 def clean_ssl(ssl):
 return ssl.replace("_VERSION", "").lower()
 
+def determine_latest_openssl(ssl):
+openssl_tags = urllib.request.urlopen("https://api.github.com/repos/openssl/openssl/tags;)
+tags = json.loads(openssl_tags.read().decode('utf-8'))
+latest_tag = ''
+for tag in tags:
+name = tag['name']
+if "openssl-" in name:
+if name > latest_tag:
+   latest_tag = name
+return "OPENSSL={}".format(latest_tag[8:])
+
 def determine_latest_libressl(ssl):
 libressl_download_list = urllib.request.urlopen("http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/;)
 for line in libressl_download_list.readlines():
@@ -119,7 +130,7 @@ for CC in ["gcc", "clang"]:
 for ssl in [
 "stock",
 "OPENSSL_VERSION=1.0.2u",
-"OPENSSL_VERSION=3.0.2",
+"OPENSSL_VERSION=latest",
 "LIBRESSL_VERSION=latest",
 "QUICTLS=yes",
 #"BORINGSSL=yes",
@@ -132,6 +143,9 @@ for CC in ["gcc", "clang"]:
 flags.append("SSL_INC=${HOME}/opt/include")
 if "LIBRESSL" in ssl and "latest" in ssl:
 ssl = determine_latest_libressl(ssl)
+if "OPENSSL" in ssl and "latest" in ssl:
+ssl = determine_latest_openssl(ssl)
+
 matrix.append(
 {
 "name": "{}, {}, ssl={}".format(clean_os(os), CC, clean_ssl(ssl)),
-- 
2.36.1