From 341dd2d1a6ce035347855351a0a4287d3c1e36ee Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Mon, 12 Oct 2026 11:20:14 +0200 Subject: [PATCH 1/2] Require blurb >= 2.2 --- requirements.in | 2 +- run_release.py | 29 ++++++++++++++++++------- tests/test_run_release.py | 45 ++++++++++++++++++++++++++++++--------- 3 files changed, 57 insertions(+), 19 deletions(-) diff --git a/requirements.in b/requirements.in index bd103463..eab3f5f5 100644 --- a/requirements.in +++ b/requirements.in @@ -4,6 +4,6 @@ paramiko alive_progress>=3.3.0 python-gnupg aiohttp -blurb>=2.1.0 +blurb>=2.2.0 requests>=2.34 sigstore>=4.5.0 diff --git a/run_release.py b/run_release.py index 20ea6c32..5257705f 100755 --- a/run_release.py +++ b/run_release.py @@ -39,6 +39,10 @@ from buildbotapi import STALE_BUILDER_DAYS, BuildBotAPI, Builder from release import ReleaseShelf, Tag, Task, ask_question +BLURB_MIN_VERSION = (2, 2) +SIGSTORE_MIN_VERSION = (4, 0) +BLURB_VERSION_PATTERN = r"^blurb version ([0-9.]+)" +SIGSTORE_VERSION_PATTERN = r"^sigstore ([0-9.]+)" API_KEY_REGEXP = re.compile(r"(?P\w+):(?P\w+)") RELEASE_REGEXP = re.compile( r"(?P\d+)\.(?P\d+)\.(?P\d+)\.?(?P.*)?" @@ -286,7 +290,6 @@ def check_tool(db: ReleaseShelf, tool: str) -> None: check_gh = functools.partial(check_tool, tool="gh") check_git = functools.partial(check_tool, tool="git") check_make = functools.partial(check_tool, tool="make") -check_blurb = functools.partial(check_tool, tool="blurb") check_autoconf = functools.partial(check_tool, tool="autoconf") check_docker = functools.partial(check_tool, tool="docker") @@ -335,20 +338,30 @@ def check_sigstore_client(db: ReleaseShelf) -> None: ) _, stdout, _ = client.exec_command("python3 -m sigstore --version") sigstore_version = stdout.read(1000).decode() - check_sigstore_version(sigstore_version) + check_tool_version( + "Sigstore", sigstore_version, SIGSTORE_VERSION_PATTERN, SIGSTORE_MIN_VERSION + ) + + +def check_blurb(db: ReleaseShelf) -> None: + check_tool(db, tool="blurb") + blurb_version = subprocess.check_output(["blurb", "--version"], text=True) + check_tool_version("blurb", blurb_version, BLURB_VERSION_PATTERN, BLURB_MIN_VERSION) -def check_sigstore_version(version: str) -> None: - version_match = re.match("^sigstore ([0-9.]+)", version) - if version_match: +def check_tool_version( + tool: str, version: str, pattern: str, minimum: tuple[int, ...] +) -> None: + if version_match := re.search(pattern, version): version_tuple = tuple(int(part) for part in version_match.group(1).split(".")) - if version_tuple >= (4, 0): + if version_tuple >= minimum: # good version return + expected = ".".join(str(part) for part in minimum) raise ReleaseException( - f"Sigstore version not detected or not valid. " - f"Expecting >= 4.0.0, got: {version}" + f"{tool} version not detected or not valid. " + f"Expecting >= {expected}, got: {version}" ) diff --git a/tests/test_run_release.py b/tests/test_run_release.py index 35008a59..ba852da4 100644 --- a/tests/test_run_release.py +++ b/tests/test_run_release.py @@ -11,27 +11,52 @@ import run_release from release import ReleaseShelf, Tag -from run_release import ReleaseException +from run_release import ( + BLURB_MIN_VERSION, + BLURB_VERSION_PATTERN, + SIGSTORE_MIN_VERSION, + SIGSTORE_VERSION_PATTERN, + ReleaseException, +) @pytest.mark.parametrize( - "version", - ["sigstore 4.0.0", "sigstore 4.1.0"], + ["version", "pattern", "minimum"], + [ + ("blurb version 2.2.0", BLURB_VERSION_PATTERN, BLURB_MIN_VERSION), + ("blurb version 2.10.0", BLURB_VERSION_PATTERN, BLURB_MIN_VERSION), + ("blurb version 3.0.0", BLURB_VERSION_PATTERN, BLURB_MIN_VERSION), + ("sigstore 4.0", SIGSTORE_VERSION_PATTERN, SIGSTORE_MIN_VERSION), + ("sigstore 4.0.0", SIGSTORE_VERSION_PATTERN, SIGSTORE_MIN_VERSION), + ("sigstore 4.1.0", SIGSTORE_VERSION_PATTERN, SIGSTORE_MIN_VERSION), + ], ) -def test_check_sigstore_version_success(version: str) -> None: +def test_check_tool_version_success( + version: str, pattern: str, minimum: tuple[int, ...] +) -> None: # Verify runs with no exceptions - run_release.check_sigstore_version(version) + run_release.check_tool_version("tool", version, pattern, minimum) @pytest.mark.parametrize( - "version", - ["sigstore 3.4.0", "sigstore 3.6.2", "sigstore 3.6.6", ""], + ["version", "pattern", "minimum"], + [ + ("blurb version 1.3.0", BLURB_VERSION_PATTERN, BLURB_MIN_VERSION), + ("blurb version 2.1.0", BLURB_VERSION_PATTERN, BLURB_MIN_VERSION), + ("sigstore 3.6.6", SIGSTORE_VERSION_PATTERN, SIGSTORE_MIN_VERSION), + ("sigstore 4.0.0", BLURB_VERSION_PATTERN, BLURB_MIN_VERSION), + ("", BLURB_VERSION_PATTERN, BLURB_MIN_VERSION), + ], ) -def test_check_sigstore_version_exception(version: str) -> None: +def test_check_tool_version_exception( + version: str, pattern: str, minimum: tuple[int, ...] +) -> None: + expected = ".".join(str(part) for part in minimum) with pytest.raises( - ReleaseException, match="Sigstore version not detected or not valid" + ReleaseException, + match=rf"tool version not detected or not valid\. Expecting >= {expected}", ): - run_release.check_sigstore_version(version) + run_release.check_tool_version("tool", version, pattern, minimum) @pytest.mark.parametrize( From 0d6a083e17c133a862e34f10a261e8ee6030e980 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Wed, 14 Oct 2026 20:26:46 +0300 Subject: [PATCH 2/2] Apply suggestion from @ezio-melotti Co-authored-by: Ezio Melotti --- run_release.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run_release.py b/run_release.py index 5257705f..4e9da6d8 100755 --- a/run_release.py +++ b/run_release.py @@ -339,7 +339,7 @@ def check_sigstore_client(db: ReleaseShelf) -> None: _, stdout, _ = client.exec_command("python3 -m sigstore --version") sigstore_version = stdout.read(1000).decode() check_tool_version( - "Sigstore", sigstore_version, SIGSTORE_VERSION_PATTERN, SIGSTORE_MIN_VERSION + "sigstore", sigstore_version, SIGSTORE_VERSION_PATTERN, SIGSTORE_MIN_VERSION )