From 0ece6ec6618cc953d6535c751869c7f57c99f4dc Mon Sep 17 00:00:00 2001 From: Vivus Ignis Date: Thu, 23 Oct 2025 14:41:03 +0200 Subject: [PATCH 01/14] not using _bucket property anymore --- src/gardenlinux/github/release_notes/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gardenlinux/github/release_notes/helpers.py b/src/gardenlinux/github/release_notes/helpers.py index 45027e0..c4c542d 100644 --- a/src/gardenlinux/github/release_notes/helpers.py +++ b/src/gardenlinux/github/release_notes/helpers.py @@ -106,7 +106,7 @@ def download_metadata_file( f"{s3_artifacts=} | {cname=} | {version=} | {commitish_short=} | {artifacts_dir=}" ) release_object = list( - s3_artifacts._bucket.objects.filter( + s3_artifacts.bucket.objects.filter( Prefix=f"meta/singles/{cname}-{version}-{commitish_short}" ) )[0] From f0859968772624f5e3701b809198855ef50dd51d Mon Sep 17 00:00:00 2001 From: Vivus Ignis Date: Thu, 23 Oct 2025 14:41:18 +0200 Subject: [PATCH 02/14] release notes mock fixed to support quoted version numbers --- .../github_release_notes_1877.3.md | 204 +++++++++--------- 1 file changed, 102 insertions(+), 102 deletions(-) diff --git a/test-data/release_notes/github_release_notes_1877.3.md b/test-data/release_notes/github_release_notes_1877.3.md index ac22830..83bd76d 100644 --- a/test-data/release_notes/github_release_notes_1877.3.md +++ b/test-data/release_notes/github_release_notes_1877.3.md @@ -174,108 +174,108 @@ systemd 257.5-2gl0 ## Changes in Package Versions Compared to 1877.2 | Package | 1877.2 | 1877.3 | |---------|--------------------|-------------------| -|bpftool | 7.5.0+6.12.40-2gl0 | 7.5.0+6.12.44-3gl0 | -|bpftool-dbgsym | 7.5.0+6.12.40-2gl0 | 7.5.0+6.12.44-3gl0 | -|dpkg | 1.22.18 | 1.22.21gl0+bp1877 | -|dpkg-dbgsym | - | 1.22.21gl0+bp1877 | -|dpkg-dev | 1.22.18 | 1.22.21gl0+bp1877 | -|dselect | - | 1.22.21gl0+bp1877 | -|dselect-dbgsym | - | 1.22.21gl0+bp1877 | -|gnutls-bin | - | 3.8.9-3gl0+bp1877 | -|gnutls-bin-dbgsym | - | 3.8.9-3gl0+bp1877 | -|gnutls-doc | - | 3.8.9-3gl0+bp1877 | -|golang-github-opencontainers-runc-dev | 1.1.15+ds1-2gl1+bp1877 | 1.3.0-1gl0+bp1877 | -|hyperv-daemons | 6.12.40-2gl0 | 6.12.44-3gl0 | -|hyperv-daemons-dbgsym | 6.12.40-2gl0 | 6.12.44-3gl0 | -|intel-sdsi | 6.12.40-2gl0 | 6.12.44-3gl0 | -|intel-sdsi-dbgsym | 6.12.40-2gl0 | 6.12.44-3gl0 | -|iputils-arping | 3:20240905-3 | 3:20250605-1gl0~bp1877 | -|iputils-arping-dbgsym | - | 3:20250605-1gl0~bp1877 | -|iputils-clockdiff | - | 3:20250605-1gl0~bp1877 | -|iputils-clockdiff-dbgsym | - | 3:20250605-1gl0~bp1877 | -|iputils-ping | 3:20240905-3 | 3:20250605-1gl0~bp1877 | -|iputils-ping-dbgsym | - | 3:20250605-1gl0~bp1877 | -|iputils-tracepath | 3:20240905-3 | 3:20250605-1gl0~bp1877 | -|iputils-tracepath-dbgsym | - | 3:20250605-1gl0~bp1877 | -|lemon | - | 3.46.1-7gl0+bp1877 | -|lemon-dbgsym | - | 3.46.1-7gl0+bp1877 | -|libcpupower-dev | 6.12.40-2gl0 | 6.12.44-3gl0 | -|libcpupower1 | 6.12.40-2gl0 | 6.12.44-3gl0 | -|libcpupower1-dbgsym | 6.12.40-2gl0 | 6.12.44-3gl0 | -|libdpkg-dev | - | 1.22.21gl0+bp1877 | -|libdpkg-perl | 1.22.18 | 1.22.21gl0+bp1877 | -|libgnutls-dane0t64 | 3.8.9-2 | 3.8.9-3gl0+bp1877 | -|libgnutls-dane0t64-dbgsym | - | 3.8.9-3gl0+bp1877 | -|libgnutls-openssl27t64 | 3.8.9-2 | 3.8.9-3gl0+bp1877 | -|libgnutls-openssl27t64-dbgsym | - | 3.8.9-3gl0+bp1877 | -|libgnutls28-dev | 3.8.9-2 | 3.8.9-3gl0+bp1877 | -|libgnutls30t64 | 3.8.9-2 | 3.8.9-3gl0+bp1877 | -|libgnutls30t64-dbgsym | - | 3.8.9-3gl0+bp1877 | -|libmd-dev | - | 1.1.0-2+b1 | -|libsqlite3-0 | 3.46.1-4 | 3.46.1-7gl0+bp1877 | -|libsqlite3-0-dbgsym | - | 3.46.1-7gl0+bp1877 | -|libsqlite3-dev | - | 3.46.1-7gl0+bp1877 | -|libsqlite3-ext-csv | - | 3.46.1-7gl0+bp1877 | -|libsqlite3-ext-csv-dbgsym | - | 3.46.1-7gl0+bp1877 | -|libsqlite3-ext-icu | - | 3.46.1-7gl0+bp1877 | -|libsqlite3-ext-icu-dbgsym | - | 3.46.1-7gl0+bp1877 | -|libsqlite3-tcl | - | 3.46.1-7gl0+bp1877 | -|libsqlite3-tcl-dbgsym | - | 3.46.1-7gl0+bp1877 | -|linux-base | 4.11 | 4.12gl0+bp1877 | -|linux-bpf-dev | 6.12.40-2gl0 | 6.12.44-3gl0 | -|linux-config-6.12 | 6.12.40-2gl0 | 6.12.44-3gl0 | -|linux-cpupower | 6.12.40-2gl0 | 6.12.44-3gl0 | -|linux-cpupower-dbgsym | 6.12.40-2gl0 | 6.12.44-3gl0 | -|linux-headers-6.12.40-amd64 | 6.12.40-2gl0 | - | -|linux-headers-6.12.40-cloud-amd64 | 6.12.40-2gl0 | - | -|linux-headers-6.12.40-common | 6.12.40-2gl0 | - | -|linux-headers-6.12.40-firecracker-amd64 | 6.12.40-2gl0 | - | -|linux-headers-6.12.44-amd64 | - | 6.12.44-3gl0 | -|linux-headers-6.12.44-cloud-amd64 | - | 6.12.44-3gl0 | -|linux-headers-6.12.44-common | - | 6.12.44-3gl0 | -|linux-headers-6.12.44-firecracker-amd64 | - | 6.12.44-3gl0 | -|linux-headers-amd64 | 6.12.40-2gl0 | 6.12.44-3gl0 | -|linux-headers-cloud-amd64 | 6.12.40-2gl0 | 6.12.44-3gl0 | -|linux-headers-firecracker-amd64 | 6.12.40-2gl0 | 6.12.44-3gl0 | -|linux-image-6.12.40-amd64 | 6.12.40-2gl0 | - | -|linux-image-6.12.40-amd64-dbg | 6.12.40-2gl0 | - | -|linux-image-6.12.40-cloud-amd64 | 6.12.40-2gl0 | - | -|linux-image-6.12.40-cloud-amd64-dbg | 6.12.40-2gl0 | - | -|linux-image-6.12.40-firecracker-amd64 | 6.12.40-2gl0 | - | -|linux-image-6.12.40-firecracker-amd64-dbg | 6.12.40-2gl0 | - | -|linux-image-6.12.44-amd64 | - | 6.12.44-3gl0 | -|linux-image-6.12.44-amd64-dbg | - | 6.12.44-3gl0 | -|linux-image-6.12.44-cloud-amd64 | - | 6.12.44-3gl0 | -|linux-image-6.12.44-cloud-amd64-dbg | - | 6.12.44-3gl0 | -|linux-image-6.12.44-firecracker-amd64 | - | 6.12.44-3gl0 | -|linux-image-6.12.44-firecracker-amd64-dbg | - | 6.12.44-3gl0 | -|linux-image-amd64 | 6.12.40-2gl0 | 6.12.44-3gl0 | -|linux-image-amd64-dbg | 6.12.40-2gl0 | 6.12.44-3gl0 | -|linux-image-cloud-amd64 | 6.12.40-2gl0 | 6.12.44-3gl0 | -|linux-image-cloud-amd64-dbg | 6.12.40-2gl0 | 6.12.44-3gl0 | -|linux-image-firecracker-amd64 | 6.12.40-2gl0 | 6.12.44-3gl0 | -|linux-image-firecracker-amd64-dbg | 6.12.40-2gl0 | 6.12.44-3gl0 | -|linux-kbuild-6.12.40 | 6.12.40-2gl0 | - | -|linux-kbuild-6.12.40-dbgsym | 6.12.40-2gl0 | - | -|linux-kbuild-6.12.44 | - | 6.12.44-3gl0 | -|linux-kbuild-6.12.44-dbgsym | - | 6.12.44-3gl0 | -|linux-libc-dev | 6.12.40-2gl0 | 6.12.44-3gl0 | -|linux-source | 6.12.40-2gl0 | 6.12.44-3gl0 | -|linux-source-6.12 | 6.12.40-2gl0 | 6.12.44-3gl0 | -|linux-support-6.12.40 | 6.12.40-2gl0 | - | -|linux-support-6.12.44 | - | 6.12.44-3gl0 | -|linux-sysctl-defaults | 4.11 | 4.12gl0+bp1877 | -|rtla | 6.12.40-2gl0 | 6.12.44-3gl0 | -|rtla-dbgsym | 6.12.40-2gl0 | 6.12.44-3gl0 | -|runc | 1.1.15+ds1-2gl1+bp1877 | 1.3.0-1gl0+bp1877 | -|runc-dbgsym | 1.1.15+ds1-2gl1+bp1877 | 1.3.0-1gl0+bp1877 | -|sqlite3 | - | 3.46.1-7gl0+bp1877 | -|sqlite3-dbgsym | - | 3.46.1-7gl0+bp1877 | -|sqlite3-doc | - | 3.46.1-7gl0+bp1877 | -|sqlite3-tools | - | 3.46.1-7gl0+bp1877 | -|sqlite3-tools-dbgsym | - | 3.46.1-7gl0+bp1877 | -|usbip | 2.0+6.12.40-2gl0 | 2.0+6.12.44-3gl0 | -|usbip-dbgsym | 2.0+6.12.40-2gl0 | 2.0+6.12.44-3gl0 | +|bpftool | `7.5.0+6.12.40-2gl0` | `7.5.0+6.12.44-3gl0` | +|bpftool-dbgsym | `7.5.0+6.12.40-2gl0` | `7.5.0+6.12.44-3gl0` | +|dpkg | `1.22.18` | `1.22.21gl0+bp1877` | +|dpkg-dbgsym | `-` | `1.22.21gl0+bp1877` | +|dpkg-dev | `1.22.18` | `1.22.21gl0+bp1877` | +|dselect | `-` | `1.22.21gl0+bp1877` | +|dselect-dbgsym | `-` | `1.22.21gl0+bp1877` | +|gnutls-bin | `-` | `3.8.9-3gl0+bp1877` | +|gnutls-bin-dbgsym | `-` | `3.8.9-3gl0+bp1877` | +|gnutls-doc | `-` | `3.8.9-3gl0+bp1877` | +|golang-github-opencontainers-runc-dev | `1.1.15+ds1-2gl1+bp1877` | `1.3.0-1gl0+bp1877` | +|hyperv-daemons | `6.12.40-2gl0` | `6.12.44-3gl0` | +|hyperv-daemons-dbgsym | `6.12.40-2gl0` | `6.12.44-3gl0` | +|intel-sdsi | `6.12.40-2gl0` | `6.12.44-3gl0` | +|intel-sdsi-dbgsym | `6.12.40-2gl0` | `6.12.44-3gl0` | +|iputils-arping | `3:20240905-3` | `3:20250605-1gl0~bp1877` | +|iputils-arping-dbgsym | `-` | `3:20250605-1gl0~bp1877` | +|iputils-clockdiff | `-` | `3:20250605-1gl0~bp1877` | +|iputils-clockdiff-dbgsym | `-` | `3:20250605-1gl0~bp1877` | +|iputils-ping | `3:20240905-3` | `3:20250605-1gl0~bp1877` | +|iputils-ping-dbgsym | `-` | `3:20250605-1gl0~bp1877` | +|iputils-tracepath | `3:20240905-3` | `3:20250605-1gl0~bp1877` | +|iputils-tracepath-dbgsym | `-` | `3:20250605-1gl0~bp1877` | +|lemon | `-` | `3.46.1-7gl0+bp1877` | +|lemon-dbgsym | `-` | `3.46.1-7gl0+bp1877` | +|libcpupower-dev | `6.12.40-2gl0` | `6.12.44-3gl0` | +|libcpupower1 | `6.12.40-2gl0` | `6.12.44-3gl0` | +|libcpupower1-dbgsym | `6.12.40-2gl0` | `6.12.44-3gl0` | +|libdpkg-dev | `-` | `1.22.21gl0+bp1877` | +|libdpkg-perl | `1.22.18` | `1.22.21gl0+bp1877` | +|libgnutls-dane0t64 | `3.8.9-2` | `3.8.9-3gl0+bp1877` | +|libgnutls-dane0t64-dbgsym | `-` | `3.8.9-3gl0+bp1877` | +|libgnutls-openssl27t64 | `3.8.9-2` | `3.8.9-3gl0+bp1877` | +|libgnutls-openssl27t64-dbgsym | `-` | `3.8.9-3gl0+bp1877` | +|libgnutls28-dev | `3.8.9-2` | `3.8.9-3gl0+bp1877` | +|libgnutls30t64 | `3.8.9-2` | `3.8.9-3gl0+bp1877` | +|libgnutls30t64-dbgsym | `-` | `3.8.9-3gl0+bp1877` | +|libmd-dev | `-` | `1.1.0-2+b1` | +|libsqlite3-0 | `3.46.1-4` | `3.46.1-7gl0+bp1877` | +|libsqlite3-0-dbgsym | `-` | `3.46.1-7gl0+bp1877` | +|libsqlite3-dev | `-` | `3.46.1-7gl0+bp1877` | +|libsqlite3-ext-csv | `-` | `3.46.1-7gl0+bp1877` | +|libsqlite3-ext-csv-dbgsym | `-` | `3.46.1-7gl0+bp1877` | +|libsqlite3-ext-icu | `-` | `3.46.1-7gl0+bp1877` | +|libsqlite3-ext-icu-dbgsym | `-` | `3.46.1-7gl0+bp1877` | +|libsqlite3-tcl | `-` | `3.46.1-7gl0+bp1877` | +|libsqlite3-tcl-dbgsym | `-` | `3.46.1-7gl0+bp1877` | +|linux-base | `4.11` | `4.12gl0+bp1877` | +|linux-bpf-dev | `6.12.40-2gl0` | `6.12.44-3gl0` | +|linux-config-6.12 | `6.12.40-2gl0` | `6.12.44-3gl0` | +|linux-cpupower | `6.12.40-2gl0` | `6.12.44-3gl0` | +|linux-cpupower-dbgsym | `6.12.40-2gl0` | `6.12.44-3gl0` | +|linux-headers-6.12.40-amd64 | `6.12.40-2gl0` | `-` | +|linux-headers-6.12.40-cloud-amd64 | `6.12.40-2gl0` | `-` | +|linux-headers-6.12.40-common | `6.12.40-2gl0` | `-` | +|linux-headers-6.12.40-firecracker-amd64 | `6.12.40-2gl0` | `-` | +|linux-headers-6.12.44-amd64 | `-` | `6.12.44-3gl0` | +|linux-headers-6.12.44-cloud-amd64 | `-` | `6.12.44-3gl0` | +|linux-headers-6.12.44-common | `-` | `6.12.44-3gl0` | +|linux-headers-6.12.44-firecracker-amd64 | `-` | `6.12.44-3gl0` | +|linux-headers-amd64 | `6.12.40-2gl0` | `6.12.44-3gl0` | +|linux-headers-cloud-amd64 | `6.12.40-2gl0` | `6.12.44-3gl0` | +|linux-headers-firecracker-amd64 | `6.12.40-2gl0` | `6.12.44-3gl0` | +|linux-image-6.12.40-amd64 | `6.12.40-2gl0` | `-` | +|linux-image-6.12.40-amd64-dbg | `6.12.40-2gl0` | `-` | +|linux-image-6.12.40-cloud-amd64 | `6.12.40-2gl0` | `-` | +|linux-image-6.12.40-cloud-amd64-dbg | `6.12.40-2gl0` | `-` | +|linux-image-6.12.40-firecracker-amd64 | `6.12.40-2gl0` | `-` | +|linux-image-6.12.40-firecracker-amd64-dbg | `6.12.40-2gl0` | `-` | +|linux-image-6.12.44-amd64 | `-` | `6.12.44-3gl0` | +|linux-image-6.12.44-amd64-dbg | `-` | `6.12.44-3gl0` | +|linux-image-6.12.44-cloud-amd64 | `-` | `6.12.44-3gl0` | +|linux-image-6.12.44-cloud-amd64-dbg | `-` | `6.12.44-3gl0` | +|linux-image-6.12.44-firecracker-amd64 | `-` | `6.12.44-3gl0` | +|linux-image-6.12.44-firecracker-amd64-dbg | `-` | `6.12.44-3gl0` | +|linux-image-amd64 | `6.12.40-2gl0` | `6.12.44-3gl0` | +|linux-image-amd64-dbg | `6.12.40-2gl0` | `6.12.44-3gl0` | +|linux-image-cloud-amd64 | `6.12.40-2gl0` | `6.12.44-3gl0` | +|linux-image-cloud-amd64-dbg | `6.12.40-2gl0` | `6.12.44-3gl0` | +|linux-image-firecracker-amd64 | `6.12.40-2gl0` | `6.12.44-3gl0` | +|linux-image-firecracker-amd64-dbg | `6.12.40-2gl0` | `6.12.44-3gl0` | +|linux-kbuild-6.12.40 | `6.12.40-2gl0` | `-` | +|linux-kbuild-6.12.40-dbgsym | `6.12.40-2gl0` | `-` | +|linux-kbuild-6.12.44 | `-` | `6.12.44-3gl0` | +|linux-kbuild-6.12.44-dbgsym | `-` | `6.12.44-3gl0` | +|linux-libc-dev | `6.12.40-2gl0` | `6.12.44-3gl0` | +|linux-source | `6.12.40-2gl0` | `6.12.44-3gl0` | +|linux-source-6.12 | `6.12.40-2gl0` | `6.12.44-3gl0` | +|linux-support-6.12.40 | `6.12.40-2gl0` | `-` | +|linux-support-6.12.44 | `-` | `6.12.44-3gl0` | +|linux-sysctl-defaults | `4.11` | `4.12gl0+bp1877` | +|rtla | `6.12.40-2gl0` | `6.12.44-3gl0` | +|rtla-dbgsym | `6.12.40-2gl0` | `6.12.44-3gl0` | +|runc | `1.1.15+ds1-2gl1+bp1877` | `1.3.0-1gl0+bp1877` | +|runc-dbgsym | `1.1.15+ds1-2gl1+bp1877` | `1.3.0-1gl0+bp1877` | +|sqlite3 | `-` | `3.46.1-7gl0+bp1877` | +|sqlite3-dbgsym | `-` | `3.46.1-7gl0+bp1877` | +|sqlite3-doc | `-` | `3.46.1-7gl0+bp1877` | +|sqlite3-tools | `-` | `3.46.1-7gl0+bp1877` | +|sqlite3-tools-dbgsym | `-` | `3.46.1-7gl0+bp1877` | +|usbip | `2.0+6.12.40-2gl0` | `2.0+6.12.44-3gl0` | +|usbip-dbgsym | `2.0+6.12.40-2gl0` | `2.0+6.12.44-3gl0` | ## Published Images
From 7f5a5b4bc4b08bbfbb0b29f3f93208f7859460e8 Mon Sep 17 00:00:00 2001 From: Vivus Ignis Date: Thu, 23 Oct 2025 14:46:47 +0200 Subject: [PATCH 03/14] calling CName constructor with the commit parameter --- src/gardenlinux/github/release_notes/helpers.py | 2 +- tests/github/test_download_metadata_files.py | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/gardenlinux/github/release_notes/helpers.py b/src/gardenlinux/github/release_notes/helpers.py index c4c542d..a4aa7d3 100644 --- a/src/gardenlinux/github/release_notes/helpers.py +++ b/src/gardenlinux/github/release_notes/helpers.py @@ -64,7 +64,7 @@ def download_all_metadata_files(version, commitish, s3_bucket_name): commitish_short = commitish[:8] for flavor in flavors: - cname = CName(flavor[1], flavor[0], "{0}-{1}".format(version, commitish_short)) + cname = CName(flavor[1], flavor[0], commitish_short) LOGGER.debug(f"{flavor=} {version=} {commitish=}") # Filter by image variants - only download if the flavor matches one of the variants flavor_matches_variant = False diff --git a/tests/github/test_download_metadata_files.py b/tests/github/test_download_metadata_files.py index 25dc273..3ca5893 100644 --- a/tests/github/test_download_metadata_files.py +++ b/tests/github/test_download_metadata_files.py @@ -23,11 +23,7 @@ def test_download_metadata_file(downloads_dir, release_s3_bucket): s3_artifacts = S3Artifacts(TEST_GARDENLINUX_RELEASE_BUCKET_NAME) s3_artifacts._bucket = release_s3_bucket - cname = CName( - "test-aws-gardener_prod", - "amd64", - "{0}-{1}".format(TEST_GARDENLINUX_RELEASE, TEST_GARDENLINUX_COMMIT_SHORT), - ) + cname = CName("test-aws-gardener_prod", "amd64", TEST_GARDENLINUX_COMMIT_SHORT) download_metadata_file( s3_artifacts, cname.cname, @@ -48,7 +44,7 @@ def test_download_metadata_file_no_such_release(downloads_dir, release_s3_bucket release = "0000.0" commit = TEST_GARDENLINUX_COMMIT_SHORT - cname = CName("aws-gardener_prod", "amd64", "{0}-{1}".format(release, commit)) + cname = CName("aws-gardener_prod", "amd64", commit) with pytest.raises(IndexError): download_metadata_file( @@ -70,7 +66,7 @@ def test_download_metadata_file_no_such_commit(downloads_dir, release_s3_bucket) release = TEST_GARDENLINUX_RELEASE commit = "deadbeef" - cname = CName("test-aws-gardener_prod", "amd64", "{0}-{1}".format(release, commit)) + cname = CName("test-aws-gardener_prod", "amd64", commit) with pytest.raises(IndexError): download_metadata_file( @@ -94,7 +90,7 @@ def test_download_metadata_file_no_such_release_and_commit( release = "0000.0" commit = "deadbeef" - cname = CName("test-aws-gardener_prod", "amd64", "{0}-{1}".format(release, commit)) + cname = CName("test-aws-gardener_prod", "amd64", commit) with pytest.raises(IndexError): download_metadata_file( From 384ff63708eeb2a035269b08f7b381b30ae770e5 Mon Sep 17 00:00:00 2001 From: Vivus Ignis Date: Thu, 23 Oct 2025 14:56:52 +0200 Subject: [PATCH 04/14] black-reformatted --- src/gardenlinux/github/__main__.py | 12 +- src/gardenlinux/github/release/__init__.py | 8 +- .../github/release_notes/__init__.py | 8 +- .../deployment_platform/__init__.py | 14 ++- tests/constants.py | 6 +- tests/features/test_cname.py | 4 +- tests/features/test_metadata_main.py | 40 +++++- tests/github/conftest.py | 13 +- tests/github/test_create_github_release.py | 46 ++++--- tests/github/test_github_script.py | 115 ++++++++++++++---- .../test_upload_to_github_release_page.py | 112 ++++++++++++----- 11 files changed, 281 insertions(+), 97 deletions(-) diff --git a/src/gardenlinux/github/__main__.py b/src/gardenlinux/github/__main__.py index de2a6f6..d3b33a2 100644 --- a/src/gardenlinux/github/__main__.py +++ b/src/gardenlinux/github/__main__.py @@ -3,7 +3,11 @@ from gardenlinux.constants import GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME from gardenlinux.logger import LoggerSetup -from .release import create_github_release, upload_to_github_release_page, write_to_release_id_file +from .release import ( + create_github_release, + upload_to_github_release_page, + write_to_release_id_file, +) from .release_notes import create_github_release_notes LOGGER = LoggerSetup.get_logger("gardenlinux.github", "INFO") @@ -18,7 +22,7 @@ def main(): create_parser.add_argument("--repo", default="gardenlinux") create_parser.add_argument("--tag", required=True) create_parser.add_argument("--commit", required=True) - create_parser.add_argument('--latest', action='store_true', default=False) + create_parser.add_argument("--latest", action="store_true", default=False) create_parser.add_argument("--dry-run", action="store_true", default=False) upload_parser = subparsers.add_parser("upload") @@ -31,7 +35,9 @@ def main(): args = parser.parse_args() if args.command == "create": - body = create_github_release_notes(args.tag, args.commit, GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME) + body = create_github_release_notes( + args.tag, args.commit, GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME + ) if args.dry_run: print("Dry Run ...") print("This release would be created:") diff --git a/src/gardenlinux/github/release/__init__.py b/src/gardenlinux/github/release/__init__.py index f6af737..18dd9cb 100644 --- a/src/gardenlinux/github/release/__init__.py +++ b/src/gardenlinux/github/release/__init__.py @@ -27,14 +27,14 @@ def create_github_release(owner, repo, tag, commitish, latest, body): "body": body, "draft": False, "prerelease": False, - "make_latest": "true" if latest else "false" + "make_latest": "true" if latest else "false", } response = requests.post( f"https://api.github.com/repos/{owner}/{repo}/releases", headers=headers, data=json.dumps(data), - timeout=REQUESTS_TIMEOUTS + timeout=REQUESTS_TIMEOUTS, ) if response.status_code == 201: @@ -84,7 +84,9 @@ def upload_to_github_release_page( LOGGER.error(f"Error reading file {file_to_upload}: {e}") return - response = requests.post(upload_url, headers=headers, data=file_contents, timeout=REQUESTS_TIMEOUTS) + response = requests.post( + upload_url, headers=headers, data=file_contents, timeout=REQUESTS_TIMEOUTS + ) if response.status_code == 201: LOGGER.info("Upload successful") else: diff --git a/src/gardenlinux/github/release_notes/__init__.py b/src/gardenlinux/github/release_notes/__init__.py index 2a9804f..d1ab7e3 100644 --- a/src/gardenlinux/github/release_notes/__init__.py +++ b/src/gardenlinux/github/release_notes/__init__.py @@ -7,7 +7,9 @@ ) -def create_github_release_notes(gardenlinux_version, commitish, releases_s3_bucket_name): +def create_github_release_notes( + gardenlinux_version, commitish, releases_s3_bucket_name +): package_list = get_package_list(gardenlinux_version) output = "" @@ -20,7 +22,9 @@ def create_github_release_notes(gardenlinux_version, commitish, releases_s3_buck gardenlinux_version, package_list ) - metadata_files = download_all_metadata_files(gardenlinux_version, commitish, releases_s3_bucket_name) + metadata_files = download_all_metadata_files( + gardenlinux_version, commitish, releases_s3_bucket_name + ) output += release_notes_image_ids_section(metadata_files) diff --git a/src/gardenlinux/github/release_notes/deployment_platform/__init__.py b/src/gardenlinux/github/release_notes/deployment_platform/__init__.py index 0c859ec..9882dc5 100644 --- a/src/gardenlinux/github/release_notes/deployment_platform/__init__.py +++ b/src/gardenlinux/github/release_notes/deployment_platform/__init__.py @@ -1,7 +1,7 @@ from gardenlinux.constants import GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME -class DeploymentPlatform(): +class DeploymentPlatform: artifacts_bucket_name = GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME def short_name(self): @@ -25,7 +25,9 @@ def image_extension(self): return "raw" def artifact_for_flavor(self, flavor, markdown_format=True): - base_url = f"https://{self.__class__.artifacts_bucket_name}.s3.amazonaws.com/objects" + base_url = ( + f"https://{self.__class__.artifacts_bucket_name}.s3.amazonaws.com/objects" + ) filename = f"{flavor}.{self.image_extension()}" download_url = f"{base_url}/{flavor}/{filename}" if markdown_format: @@ -48,7 +50,9 @@ def region_details(self, image_metadata): "image_id": image_id, "image_name": image_name, }: - details += f"**{region_name}:** {image_id} ({image_name})
" + details += ( + f"**{region_name}:** {image_id} ({image_name})
" + ) case {"region": region_name, "image_id": image_id}: details += f"**{region_name}:** {image_id}
" case {"details": details_dict}: @@ -93,7 +97,9 @@ def summary_text(self, image_metadata): }: gallery_count = len(gallery_images) marketplace_count = len(marketplace_images) - return f"{gallery_count} gallery + {marketplace_count} marketplace images" + return ( + f"{gallery_count} gallery + {marketplace_count} marketplace images" + ) case {"gallery_images": gallery_images}: gallery_count = len(gallery_images) return f"{gallery_count} gallery images" diff --git a/tests/constants.py b/tests/constants.py index 47cc039..3eec28d 100644 --- a/tests/constants.py +++ b/tests/constants.py @@ -27,7 +27,9 @@ TEST_GARDENLINUX_COMMIT_SHORT = TEST_GARDENLINUX_COMMIT[:8] TEST_GARDENLINUX_RELEASE_BUCKET_NAME = "test__gardenlinux__releases" -RELEASE_NOTES_TEST_DATA_DIR = Path(os.path.dirname(__file__)) / ".." / "test-data" / "release_notes" +RELEASE_NOTES_TEST_DATA_DIR = ( + Path(os.path.dirname(__file__)) / ".." / "test-data" / "release_notes" +) RELEASE_NOTES_S3_ARTIFACTS_DIR = RELEASE_NOTES_TEST_DATA_DIR / "s3_bucket_artifacts" RELEASE_ARTIFACTS_METADATA_FILES = [ @@ -83,5 +85,5 @@ "openstack-gardener_prod_usi-amd64.s3_metadata.yaml", "openstack-gardener_prod_usi-arm64.s3_metadata.yaml", "vmware-gardener_prod-amd64.s3_metadata.yaml", - "vmware-gardener_prod-arm64.s3_metadata.yaml" + "vmware-gardener_prod-arm64.s3_metadata.yaml", ] diff --git a/tests/features/test_cname.py b/tests/features/test_cname.py index 4a12ef2..de619a5 100644 --- a/tests/features/test_cname.py +++ b/tests/features/test_cname.py @@ -44,5 +44,7 @@ def test_cname_commit_id_setter(): cname = CName("container", arch="amd64", version="today", commit_hash="local") # Act / Assert - with pytest.raises(RuntimeError, match="Commit hash given differs from commit ID already set"): + with pytest.raises( + RuntimeError, match="Commit hash given differs from commit ID already set" + ): cname.commit_hash = "broken" diff --git a/tests/features/test_metadata_main.py b/tests/features/test_metadata_main.py index 26c0f56..ad23005 100644 --- a/tests/features/test_metadata_main.py +++ b/tests/features/test_metadata_main.py @@ -38,12 +38,22 @@ def get_container_amd64_release_metadata(version, commit_hash): GARDENLINUX_COMMIT_ID_LONG="local" """.strip() + def test_main_output(monkeypatch, capsys): """ Test successful "output-release-metadata" """ # Arrange - argv = ["prog", "--cname", "container-amd64", "--version", "today", "--commit", "local", "output-release-metadata"] + argv = [ + "prog", + "--cname", + "container-amd64", + "--version", + "today", + "--commit", + "local", + "output-release-metadata", + ] monkeypatch.setattr(sys, "argv", argv) # Act @@ -53,6 +63,7 @@ def test_main_output(monkeypatch, capsys): expected = get_container_amd64_release_metadata("today", "local") assert expected == capsys.readouterr().out.strip() + def test_main_write(monkeypatch, capsys): """ Test successful "write" @@ -60,7 +71,18 @@ def test_main_write(monkeypatch, capsys): # Arrange with TemporaryDirectory() as tmpdir: os_release_file = Path(tmpdir, "os_release") - argv = ["prog", "--cname", "container-amd64", "--version", "today", "--commit", "local", "--release-file", str(os_release_file), "write"] + argv = [ + "prog", + "--cname", + "container-amd64", + "--version", + "today", + "--commit", + "local", + "--release-file", + str(os_release_file), + "write", + ] monkeypatch.setattr(sys, "argv", argv) # Act @@ -70,6 +92,7 @@ def test_main_write(monkeypatch, capsys): expected = get_container_amd64_release_metadata("today", "local") assert expected == os_release_file.open("r").read() + def test_main_validation(monkeypatch): """ Test validation between release metadata and arguments given @@ -81,7 +104,18 @@ def test_main_validation(monkeypatch): with os_release_file.open("w") as fp: fp.write(get_container_amd64_release_metadata("today", "local")) - argv = ["prog", "--cname", "base-python-amd64", "--version", "today", "--commit", "local", "--release-file", str(os_release_file), "output-release-metadata"] + argv = [ + "prog", + "--cname", + "base-python-amd64", + "--version", + "today", + "--commit", + "local", + "--release-file", + str(os_release_file), + "output-release-metadata", + ] monkeypatch.setattr(sys, "argv", argv) # Act / Assert diff --git a/tests/github/conftest.py b/tests/github/conftest.py index 2f1dcff..a9e694c 100644 --- a/tests/github/conftest.py +++ b/tests/github/conftest.py @@ -44,8 +44,10 @@ def release_id_file(): def release_s3_bucket(): with mock_aws(): s3 = boto3.resource("s3", region_name="eu-central-1") - s3.create_bucket(Bucket=TEST_GARDENLINUX_RELEASE_BUCKET_NAME, - CreateBucketConfiguration={"LocationConstraint": "eu-central-1"}) + s3.create_bucket( + Bucket=TEST_GARDENLINUX_RELEASE_BUCKET_NAME, + CreateBucketConfiguration={"LocationConstraint": "eu-central-1"}, + ) yield s3.Bucket(TEST_GARDENLINUX_RELEASE_BUCKET_NAME) @@ -55,19 +57,20 @@ def blackhole_s3_bucket(): any object can be found, but downloading a file always raises an exception. This is needed to test the retry mechanism as the object also counts how many times an exception was raised.""" - class BlackHoleObject(): + + class BlackHoleObject: def __init__(self, bucket_name, key): self.bucket_name = bucket_name self.key = key - class BlackHoleObjects(): + class BlackHoleObjects: def __init__(self, bucket_name): self.bucket_name = bucket_name def filter(self, Prefix): return [BlackHoleObject(self.bucket_name, Prefix)] - class BlackHoleS3Bucket(): + class BlackHoleS3Bucket: def __init__(self, bucket_name): self.objects = BlackHoleObjects(bucket_name) self.download_attempts = 0 diff --git a/tests/github/test_create_github_release.py b/tests/github/test_create_github_release.py index a2919a6..c876729 100644 --- a/tests/github/test_create_github_release.py +++ b/tests/github/test_create_github_release.py @@ -19,9 +19,11 @@ def test_create_github_release_needs_github_token(): TEST_GARDENLINUX_RELEASE, TEST_GARDENLINUX_COMMIT, False, - "") - assert str(exn.value) == "GITHUB_TOKEN environment variable not set", \ - "Expected an exception to be raised on missing GITHUB_TOKEN environment variable" + "", + ) + assert ( + str(exn.value) == "GITHUB_TOKEN environment variable not set" + ), "Expected an exception to be raised on missing GITHUB_TOKEN environment variable" def test_create_github_release_raise_on_failure(caplog, github_token): @@ -30,7 +32,7 @@ def test_create_github_release_raise_on_failure(caplog, github_token): m.post( "https://api.github.com/repos/gardenlinux/gardenlinux/releases", text="{}", - status_code=503 + status_code=503, ) create_github_release( "gardenlinux", @@ -38,8 +40,11 @@ def test_create_github_release_raise_on_failure(caplog, github_token): TEST_GARDENLINUX_RELEASE, TEST_GARDENLINUX_COMMIT, False, - "") - assert any("Failed to create release" in record.message for record in caplog.records), "Expected a failure log record" + "", + ) + assert any( + "Failed to create release" in record.message for record in caplog.records + ), "Expected a failure log record" def test_create_github_release(caplog, github_token): @@ -47,16 +52,23 @@ def test_create_github_release(caplog, github_token): m.post( "https://api.github.com/repos/gardenlinux/gardenlinux/releases", text='{"id": 101}', - status_code=201 + status_code=201, + ) + assert ( + create_github_release( + "gardenlinux", + "gardenlinux", + TEST_GARDENLINUX_RELEASE, + TEST_GARDENLINUX_COMMIT, + False, + "", + ) + == 101 ) - assert create_github_release( - "gardenlinux", - "gardenlinux", - TEST_GARDENLINUX_RELEASE, - TEST_GARDENLINUX_COMMIT, - False, - "") == 101 - assert any("Release created successfully" in record.message for record in caplog.records), "Expected a success log record" + assert any( + "Release created successfully" in record.message + for record in caplog.records + ), "Expected a success log record" def test_write_to_release_id_file(release_id_file): @@ -69,4 +81,6 @@ def test_write_to_release_id_file_broken_file_permissions(release_id_file, caplo with pytest.raises(SystemExit): write_to_release_id_file(TEST_GARDENLINUX_RELEASE) - assert any("Could not create" in record.message for record in caplog.records), "Expected a failure log record" + assert any( + "Could not create" in record.message for record in caplog.records + ), "Expected a failure log record" diff --git a/tests/github/test_github_script.py b/tests/github/test_github_script.py index c94885a..14c5569 100644 --- a/tests/github/test_github_script.py +++ b/tests/github/test_github_script.py @@ -15,64 +15,129 @@ def test_script_parse_args_wrong_command(monkeypatch, capfd): gh.main() captured = capfd.readouterr() - assert "argument command: invalid choice: 'rejoice'" in captured.err, "Expected help message printed" + assert ( + "argument command: invalid choice: 'rejoice'" in captured.err + ), "Expected help message printed" def test_script_parse_args_create_command_required_args(monkeypatch, capfd): - monkeypatch.setattr(sys, "argv", ["gh", "create", "--owner", "gardenlinux", "--repo", "gardenlinux"]) + monkeypatch.setattr( + sys, "argv", ["gh", "create", "--owner", "gardenlinux", "--repo", "gardenlinux"] + ) with pytest.raises(SystemExit): gh.main() captured = capfd.readouterr() - assert "the following arguments are required: --tag, --commit" in captured.err, \ - "Expected help message on missing arguments for 'create' command" + assert ( + "the following arguments are required: --tag, --commit" in captured.err + ), "Expected help message on missing arguments for 'create' command" def test_script_parse_args_upload_command_required_args(monkeypatch, capfd): - monkeypatch.setattr(sys, "argv", ["gh", "upload", "--owner", "gardenlinux", "--repo", "gardenlinux"]) + monkeypatch.setattr( + sys, "argv", ["gh", "upload", "--owner", "gardenlinux", "--repo", "gardenlinux"] + ) with pytest.raises(SystemExit): gh.main() captured = capfd.readouterr() - assert "the following arguments are required: --release_id, --file_path" in captured.err, \ - "Expected help message on missing arguments for 'upload' command" + assert ( + "the following arguments are required: --release_id, --file_path" + in captured.err + ), "Expected help message on missing arguments for 'upload' command" def test_script_create_dry_run(monkeypatch, capfd): - monkeypatch.setattr(sys, "argv", ["gh", "create", "--owner", "gardenlinux", "--repo", - "gardenlinux", "--tag", TEST_GARDENLINUX_RELEASE, "--commit", TEST_GARDENLINUX_COMMIT, "--dry-run"]) - monkeypatch.setattr("gardenlinux.github.__main__.create_github_release_notes", - lambda tag, commit, bucket: f"{tag} {commit} {bucket}") + monkeypatch.setattr( + sys, + "argv", + [ + "gh", + "create", + "--owner", + "gardenlinux", + "--repo", + "gardenlinux", + "--tag", + TEST_GARDENLINUX_RELEASE, + "--commit", + TEST_GARDENLINUX_COMMIT, + "--dry-run", + ], + ) + monkeypatch.setattr( + "gardenlinux.github.__main__.create_github_release_notes", + lambda tag, commit, bucket: f"{tag} {commit} {bucket}", + ) gh.main() captured = capfd.readouterr() - assert captured.out == f"Dry Run ...\nThis release would be created:\n{TEST_GARDENLINUX_RELEASE} {TEST_GARDENLINUX_COMMIT} {GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME}\n", \ - "Expected dry-run create to return generated release notes text" + assert ( + captured.out + == f"Dry Run ...\nThis release would be created:\n{TEST_GARDENLINUX_RELEASE} {TEST_GARDENLINUX_COMMIT} {GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME}\n" + ), "Expected dry-run create to return generated release notes text" def test_script_create(monkeypatch, caplog): - monkeypatch.setattr(sys, "argv", ["gh", "create", "--owner", "gardenlinux", "--repo", - "gardenlinux", "--tag", TEST_GARDENLINUX_RELEASE, "--commit", TEST_GARDENLINUX_COMMIT]) - monkeypatch.setattr("gardenlinux.github.__main__.create_github_release_notes", - lambda tag, commit, bucket: f"{tag} {commit} {bucket}") - monkeypatch.setattr("gardenlinux.github.__main__.create_github_release", - lambda a1, a2, a3, a4, a5, a6: TEST_GARDENLINUX_RELEASE) + monkeypatch.setattr( + sys, + "argv", + [ + "gh", + "create", + "--owner", + "gardenlinux", + "--repo", + "gardenlinux", + "--tag", + TEST_GARDENLINUX_RELEASE, + "--commit", + TEST_GARDENLINUX_COMMIT, + ], + ) + monkeypatch.setattr( + "gardenlinux.github.__main__.create_github_release_notes", + lambda tag, commit, bucket: f"{tag} {commit} {bucket}", + ) + monkeypatch.setattr( + "gardenlinux.github.__main__.create_github_release", + lambda a1, a2, a3, a4, a5, a6: TEST_GARDENLINUX_RELEASE, + ) gh.main() - assert any(f"Release created with ID: {TEST_GARDENLINUX_RELEASE}" in record.message for record in caplog.records), \ - "Expected a release creation confirmation log entry" + assert any( + f"Release created with ID: {TEST_GARDENLINUX_RELEASE}" in record.message + for record in caplog.records + ), "Expected a release creation confirmation log entry" def test_script_upload_dry_run(monkeypatch, capfd): - monkeypatch.setattr(sys, "argv", ["gh", "upload", "--owner", "gardenlinux", "--repo", - "gardenlinux", "--release_id", TEST_GARDENLINUX_RELEASE, "--file_path", "foo", "--dry-run"]) - monkeypatch.setattr("gardenlinux.github.__main__.upload_to_github_release_page", - lambda a1, a2, a3, a4, dry_run: print(f"dry-run: {dry_run}")) + monkeypatch.setattr( + sys, + "argv", + [ + "gh", + "upload", + "--owner", + "gardenlinux", + "--repo", + "gardenlinux", + "--release_id", + TEST_GARDENLINUX_RELEASE, + "--file_path", + "foo", + "--dry-run", + ], + ) + monkeypatch.setattr( + "gardenlinux.github.__main__.upload_to_github_release_page", + lambda a1, a2, a3, a4, dry_run: print(f"dry-run: {dry_run}"), + ) gh.main() captured = capfd.readouterr() diff --git a/tests/github/test_upload_to_github_release_page.py b/tests/github/test_upload_to_github_release_page.py index 152b3d8..09596c7 100644 --- a/tests/github/test_upload_to_github_release_page.py +++ b/tests/github/test_upload_to_github_release_page.py @@ -12,16 +12,24 @@ def test_upload_to_github_release_page_dryrun(caplog, artifact_for_upload): with requests_mock.Mocker(): - assert upload_to_github_release_page( - "gardenlinux", - "gardenlinux", - TEST_GARDENLINUX_RELEASE, - artifact_for_upload, - dry_run=True) is None - assert any("Dry run: would upload" in record.message for record in caplog.records), "Expected a dry‑run log entry" + assert ( + upload_to_github_release_page( + "gardenlinux", + "gardenlinux", + TEST_GARDENLINUX_RELEASE, + artifact_for_upload, + dry_run=True, + ) + is None + ) + assert any( + "Dry run: would upload" in record.message for record in caplog.records + ), "Expected a dry‑run log entry" -def test_upload_to_github_release_page_needs_github_token(downloads_dir, artifact_for_upload): +def test_upload_to_github_release_page_needs_github_token( + downloads_dir, artifact_for_upload +): with requests_mock.Mocker(): with pytest.raises(ValueError) as exn: upload_to_github_release_page( @@ -29,17 +37,21 @@ def test_upload_to_github_release_page_needs_github_token(downloads_dir, artifac "gardenlinux", TEST_GARDENLINUX_RELEASE, artifact_for_upload, - dry_run=False) - assert str(exn.value) == "GITHUB_TOKEN environment variable not set", \ - "Expected an exception to be raised on missing GITHUB_TOKEN environment variable" + dry_run=False, + ) + assert ( + str(exn.value) == "GITHUB_TOKEN environment variable not set" + ), "Expected an exception to be raised on missing GITHUB_TOKEN environment variable" -def test_upload_to_github_release_page(downloads_dir, caplog, github_token, artifact_for_upload): +def test_upload_to_github_release_page( + downloads_dir, caplog, github_token, artifact_for_upload +): with requests_mock.Mocker(real_http=True) as m: m.post( f"https://uploads.github.com/repos/gardenlinux/gardenlinux/releases/{TEST_GARDENLINUX_RELEASE}/assets?name=artifact.log", text="{}", - status_code=201 + status_code=201, ) upload_to_github_release_page( @@ -47,12 +59,16 @@ def test_upload_to_github_release_page(downloads_dir, caplog, github_token, arti "gardenlinux", TEST_GARDENLINUX_RELEASE, artifact_for_upload, - dry_run=False) - assert any("Upload successful" in record.message for record in caplog.records), \ - "Expected an upload confirmation log entry" + dry_run=False, + ) + assert any( + "Upload successful" in record.message for record in caplog.records + ), "Expected an upload confirmation log entry" -def test_upload_to_github_release_page_unreadable_artifact(downloads_dir, caplog, github_token, artifact_for_upload): +def test_upload_to_github_release_page_unreadable_artifact( + downloads_dir, caplog, github_token, artifact_for_upload +): artifact_for_upload.chmod(0) upload_to_github_release_page( @@ -60,17 +76,21 @@ def test_upload_to_github_release_page_unreadable_artifact(downloads_dir, caplog "gardenlinux", TEST_GARDENLINUX_RELEASE, artifact_for_upload, - dry_run=False) - assert any("Error reading file" in record.message for record in caplog.records), \ - "Expected an error message log entry" + dry_run=False, + ) + assert any( + "Error reading file" in record.message for record in caplog.records + ), "Expected an error message log entry" -def test_upload_to_github_release_page_failed(downloads_dir, caplog, github_token, artifact_for_upload): +def test_upload_to_github_release_page_failed( + downloads_dir, caplog, github_token, artifact_for_upload +): with requests_mock.Mocker(real_http=True) as m: m.post( f"https://uploads.github.com/repos/gardenlinux/gardenlinux/releases/{TEST_GARDENLINUX_RELEASE}/assets?name=artifact.log", text="{}", - status_code=503 + status_code=503, ) with pytest.raises(requests.exceptions.HTTPError): @@ -79,9 +99,12 @@ def test_upload_to_github_release_page_failed(downloads_dir, caplog, github_toke "gardenlinux", TEST_GARDENLINUX_RELEASE, artifact_for_upload, - dry_run=False) - assert any("Upload failed with status code 503:" in record.message for record in caplog.records), \ - "Expected an error HTTP status code to be logged" + dry_run=False, + ) + assert any( + "Upload failed with status code 503:" in record.message + for record in caplog.records + ), "Expected an error HTTP status code to be logged" def test_script_parse_args_wrong_command(monkeypatch, capfd): @@ -91,25 +114,48 @@ def test_script_parse_args_wrong_command(monkeypatch, capfd): gh.main() captured = capfd.readouterr() - assert "argument command: invalid choice: 'rejoice'" in captured.err, "Expected help message printed" + assert ( + "argument command: invalid choice: 'rejoice'" in captured.err + ), "Expected help message printed" def test_script_parse_args_upload_command_required_args(monkeypatch, capfd): - monkeypatch.setattr(sys, "argv", ["gh", "upload", "--owner", "gardenlinux", "--repo", "gardenlinux"]) + monkeypatch.setattr( + sys, "argv", ["gh", "upload", "--owner", "gardenlinux", "--repo", "gardenlinux"] + ) with pytest.raises(SystemExit): gh.main() captured = capfd.readouterr() - assert "the following arguments are required: --release_id, --file_path" in captured.err, \ - "Expected help message on missing arguments for 'upload' command" + assert ( + "the following arguments are required: --release_id, --file_path" + in captured.err + ), "Expected help message on missing arguments for 'upload' command" def test_script_upload_dry_run(monkeypatch, capfd): - monkeypatch.setattr(sys, "argv", ["gh", "upload", "--owner", "gardenlinux", "--repo", - "gardenlinux", "--release_id", TEST_GARDENLINUX_RELEASE, "--file_path", "foo", "--dry-run"]) - monkeypatch.setattr("gardenlinux.github.__main__.upload_to_github_release_page", - lambda a1, a2, a3, a4, dry_run: print(f"dry-run: {dry_run}")) + monkeypatch.setattr( + sys, + "argv", + [ + "gh", + "upload", + "--owner", + "gardenlinux", + "--repo", + "gardenlinux", + "--release_id", + TEST_GARDENLINUX_RELEASE, + "--file_path", + "foo", + "--dry-run", + ], + ) + monkeypatch.setattr( + "gardenlinux.github.__main__.upload_to_github_release_page", + lambda a1, a2, a3, a4, dry_run: print(f"dry-run: {dry_run}"), + ) gh.main() captured = capfd.readouterr() From d9e889217f870f0850c182be6df948669f7802dd Mon Sep 17 00:00:00 2001 From: Vivus Ignis Date: Thu, 23 Oct 2025 15:14:31 +0200 Subject: [PATCH 05/14] disabled useless pyright check for deployment_platform classes --- .../github/release_notes/deployment_platform/ali_cloud.py | 1 + .../release_notes/deployment_platform/amazon_web_services.py | 1 + .../github/release_notes/deployment_platform/azure.py | 1 + .../github/release_notes/deployment_platform/google_cloud.py | 1 + .../github/release_notes/deployment_platform/openstack.py | 1 + .../release_notes/deployment_platform/openstack_baremetal.py | 1 + 6 files changed, 6 insertions(+) diff --git a/src/gardenlinux/github/release_notes/deployment_platform/ali_cloud.py b/src/gardenlinux/github/release_notes/deployment_platform/ali_cloud.py index a9d38c0..cf40945 100644 --- a/src/gardenlinux/github/release_notes/deployment_platform/ali_cloud.py +++ b/src/gardenlinux/github/release_notes/deployment_platform/ali_cloud.py @@ -1,3 +1,4 @@ +# pyright: reportIncompatibleMethodOverride=false from . import DeploymentPlatform diff --git a/src/gardenlinux/github/release_notes/deployment_platform/amazon_web_services.py b/src/gardenlinux/github/release_notes/deployment_platform/amazon_web_services.py index 4353fe8..5013d08 100644 --- a/src/gardenlinux/github/release_notes/deployment_platform/amazon_web_services.py +++ b/src/gardenlinux/github/release_notes/deployment_platform/amazon_web_services.py @@ -1,3 +1,4 @@ +# pyright: reportIncompatibleMethodOverride=false from . import DeploymentPlatform diff --git a/src/gardenlinux/github/release_notes/deployment_platform/azure.py b/src/gardenlinux/github/release_notes/deployment_platform/azure.py index ee41665..58201a3 100644 --- a/src/gardenlinux/github/release_notes/deployment_platform/azure.py +++ b/src/gardenlinux/github/release_notes/deployment_platform/azure.py @@ -1,3 +1,4 @@ +# pyright: reportIncompatibleMethodOverride=false from . import DeploymentPlatform diff --git a/src/gardenlinux/github/release_notes/deployment_platform/google_cloud.py b/src/gardenlinux/github/release_notes/deployment_platform/google_cloud.py index f42457c..bbad856 100644 --- a/src/gardenlinux/github/release_notes/deployment_platform/google_cloud.py +++ b/src/gardenlinux/github/release_notes/deployment_platform/google_cloud.py @@ -1,3 +1,4 @@ +# pyright: reportIncompatibleMethodOverride=false from . import DeploymentPlatform diff --git a/src/gardenlinux/github/release_notes/deployment_platform/openstack.py b/src/gardenlinux/github/release_notes/deployment_platform/openstack.py index 06cdd9c..82a1c6a 100644 --- a/src/gardenlinux/github/release_notes/deployment_platform/openstack.py +++ b/src/gardenlinux/github/release_notes/deployment_platform/openstack.py @@ -1,3 +1,4 @@ +# pyright: reportIncompatibleMethodOverride=false from . import DeploymentPlatform diff --git a/src/gardenlinux/github/release_notes/deployment_platform/openstack_baremetal.py b/src/gardenlinux/github/release_notes/deployment_platform/openstack_baremetal.py index ddef8fd..17d1c80 100644 --- a/src/gardenlinux/github/release_notes/deployment_platform/openstack_baremetal.py +++ b/src/gardenlinux/github/release_notes/deployment_platform/openstack_baremetal.py @@ -1,3 +1,4 @@ +# pyright: reportIncompatibleMethodOverride=false from .openstack import OpenStack From 56d1f0ea9da791e92e1911227b9e3ec66d76fac3 Mon Sep 17 00:00:00 2001 From: Vivus Ignis Date: Thu, 23 Oct 2025 15:15:01 +0200 Subject: [PATCH 06/14] warn() method is deprecated in logging library --- src/gardenlinux/github/release_notes/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gardenlinux/github/release_notes/helpers.py b/src/gardenlinux/github/release_notes/helpers.py index a4aa7d3..cde5c54 100644 --- a/src/gardenlinux/github/release_notes/helpers.py +++ b/src/gardenlinux/github/release_notes/helpers.py @@ -90,7 +90,7 @@ def download_all_metadata_files(version, commitish, s3_bucket_name): s3_artifacts, cname.cname, version, commitish_short, local_dest_path ) except IndexError: - LOGGER.warn(f"No artifacts found for flavor {cname.cname}, skipping...") + LOGGER.warning(f"No artifacts found for flavor {cname.cname}, skipping...") continue return [str(artifact) for artifact in local_dest_path.iterdir()] From f237e18cdc65fa96d8bce05484a58e86d3b9f199 Mon Sep 17 00:00:00 2001 From: Vivus Ignis Date: Thu, 23 Oct 2025 15:42:22 +0200 Subject: [PATCH 07/14] replaced unneeded short commit --- src/gardenlinux/github/release_notes/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gardenlinux/github/release_notes/helpers.py b/src/gardenlinux/github/release_notes/helpers.py index a4aa7d3..5111efc 100644 --- a/src/gardenlinux/github/release_notes/helpers.py +++ b/src/gardenlinux/github/release_notes/helpers.py @@ -64,7 +64,7 @@ def download_all_metadata_files(version, commitish, s3_bucket_name): commitish_short = commitish[:8] for flavor in flavors: - cname = CName(flavor[1], flavor[0], commitish_short) + cname = CName(flavor[1], flavor[0], commitish) LOGGER.debug(f"{flavor=} {version=} {commitish=}") # Filter by image variants - only download if the flavor matches one of the variants flavor_matches_variant = False From 1b7e0209a13c83e22350396e4539f5ab6e264a93 Mon Sep 17 00:00:00 2001 From: Vivus Ignis Date: Thu, 23 Oct 2025 16:03:46 +0200 Subject: [PATCH 08/14] removed unused imports --- src/gardenlinux/features/cname.py | 1 - src/gardenlinux/features/metadata_main.py | 13 +------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/gardenlinux/features/cname.py b/src/gardenlinux/features/cname.py index 66e4d37..d8ce7d7 100644 --- a/src/gardenlinux/features/cname.py +++ b/src/gardenlinux/features/cname.py @@ -13,7 +13,6 @@ from ..constants import ( ARCHS, GL_BUG_REPORT_URL, - GL_COMMIT_SPECIAL_VALUES, GL_DISTRIBUTION_NAME, GL_HOME_URL, GL_RELEASE_ID, diff --git a/src/gardenlinux/features/metadata_main.py b/src/gardenlinux/features/metadata_main.py index 84928ba..9497e02 100644 --- a/src/gardenlinux/features/metadata_main.py +++ b/src/gardenlinux/features/metadata_main.py @@ -6,19 +6,8 @@ """ import argparse -import logging -import re -from functools import reduce -from os.path import basename, dirname - -from .__main__ import ( - get_cname_base, - get_minimal_feature_set, - get_version_and_commit_id_from_files, - sort_subset, -) + from .cname import CName -from .parser import Parser _ARGS_ACTION_ALLOWED = [ "output-release-metadata", From 774d0bdd588d59b1f7228d037f95cde05c29983d Mon Sep 17 00:00:00 2001 From: Vivus Ignis Date: Thu, 23 Oct 2025 16:09:35 +0200 Subject: [PATCH 09/14] removed more unused imports --- src/gardenlinux/oci/__main__.py | 3 --- src/gardenlinux/oci/container.py | 6 ++---- tests/conftest.py | 3 +-- tests/features/test_cname_main.py | 1 - tests/flavors/test_init.py | 1 - tests/helper.py | 3 --- tests/oci/test_container.py | 3 --- tests/oci/test_index.py | 1 - tests/oci/test_layer.py | 3 --- 9 files changed, 3 insertions(+), 21 deletions(-) diff --git a/src/gardenlinux/oci/__main__.py b/src/gardenlinux/oci/__main__.py index 5acb9a9..6f3a8fd 100755 --- a/src/gardenlinux/oci/__main__.py +++ b/src/gardenlinux/oci/__main__.py @@ -4,10 +4,7 @@ gl-oci main entrypoint """ -import os - import click -from pygments.lexer import default from .container import Container diff --git a/src/gardenlinux/oci/container.py b/src/gardenlinux/oci/container.py index 9ed98f7..28b581a 100644 --- a/src/gardenlinux/oci/container.py +++ b/src/gardenlinux/oci/container.py @@ -9,7 +9,6 @@ from base64 import b64encode from collections.abc import Sequence from configparser import UNNAMED_SECTION, ConfigParser -from hashlib import sha256 from os import PathLike, fdopen, getenv from pathlib import Path from tempfile import mkstemp @@ -18,12 +17,11 @@ import jsonschema from oras.container import Container as OrasContainer -from oras.defaults import unknown_config_media_type as UNKNOWN_CONFIG_MEDIA_TYPE from oras.provider import Registry from oras.utils import extract_targz, make_targz from requests import Response -from ..constants import GL_MEDIA_TYPE_LOOKUP, OCI_IMAGE_INDEX_MEDIA_TYPE +from ..constants import OCI_IMAGE_INDEX_MEDIA_TYPE from ..features.cname import CName from ..logger import LoggerSetup from .image_manifest import ImageManifest @@ -117,7 +115,7 @@ def __init__( # Login to registry if credentials are provided if username and password: - self._logger.debug(f"Logging in with username/password") + self._logger.debug("Logging in with username/password") try: self.login(username, password) diff --git a/tests/conftest.py b/tests/conftest.py index 238b133..b99a348 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,7 +1,6 @@ import json import os import shutil -import subprocess import sys from datetime import datetime, timedelta from tempfile import mkstemp @@ -27,7 +26,7 @@ TEST_PLATFORMS, TEST_VERSION, ) -from .helper import call_command, spawn_background_process +from .helper import spawn_background_process def generate_test_certificates(): diff --git a/tests/features/test_cname_main.py b/tests/features/test_cname_main.py index f0aa216..6c3151c 100644 --- a/tests/features/test_cname_main.py +++ b/tests/features/test_cname_main.py @@ -5,7 +5,6 @@ import pytest import gardenlinux.features.cname_main as cname_main -from gardenlinux.features import CName def test_main_happy(monkeypatch, capsys): diff --git a/tests/flavors/test_init.py b/tests/flavors/test_init.py index 05b5560..8207df9 100644 --- a/tests/flavors/test_init.py +++ b/tests/flavors/test_init.py @@ -1,5 +1,4 @@ import importlib -import types from gardenlinux import flavors diff --git a/tests/helper.py b/tests/helper.py index e0034f0..7d9a82c 100644 --- a/tests/helper.py +++ b/tests/helper.py @@ -1,9 +1,6 @@ -import os import shlex import subprocess -from .constants import CERT_DIR, GL_ROOT_DIR, ZOT_CONFIG_FILE - def spawn_background_process(cmd, stdout=None, stderr=None): args = shlex.split(cmd) diff --git a/tests/oci/test_container.py b/tests/oci/test_container.py index 2465fac..b386438 100644 --- a/tests/oci/test_container.py +++ b/tests/oci/test_container.py @@ -1,6 +1,3 @@ -import io -import json -import logging from base64 import b64encode import pytest diff --git a/tests/oci/test_index.py b/tests/oci/test_index.py index c2b34ec..3a4904e 100644 --- a/tests/oci/test_index.py +++ b/tests/oci/test_index.py @@ -1,4 +1,3 @@ -import io import json import pytest diff --git a/tests/oci/test_layer.py b/tests/oci/test_layer.py index 85df0b6..15fca53 100644 --- a/tests/oci/test_layer.py +++ b/tests/oci/test_layer.py @@ -1,6 +1,3 @@ -import builtins -from pathlib import Path - import pytest import gardenlinux.oci.layer as gl_layer From b992c4e2dee81c86bbbde1507f522880d12cb83e Mon Sep 17 00:00:00 2001 From: Vivus Ignis Date: Thu, 23 Oct 2025 16:13:37 +0200 Subject: [PATCH 10/14] nuked more unused imports --- src/gardenlinux/flavors/__main__.py | 2 -- tests/features/test_metadata_main.py | 4 ---- tests/flavors/test_main.py | 3 --- tests/flavors/test_parser.py | 2 -- 4 files changed, 11 deletions(-) diff --git a/src/gardenlinux/flavors/__main__.py b/src/gardenlinux/flavors/__main__.py index db3f50c..dda219d 100644 --- a/src/gardenlinux/flavors/__main__.py +++ b/src/gardenlinux/flavors/__main__.py @@ -6,8 +6,6 @@ """ import json -import os -import sys from argparse import ArgumentParser from pathlib import Path from tempfile import TemporaryDirectory diff --git a/tests/features/test_metadata_main.py b/tests/features/test_metadata_main.py index ad23005..0e1d092 100644 --- a/tests/features/test_metadata_main.py +++ b/tests/features/test_metadata_main.py @@ -1,6 +1,4 @@ -import logging import sys -import types from pathlib import Path from tempfile import TemporaryDirectory @@ -9,13 +7,11 @@ import gardenlinux.features.metadata_main as metadata_main from gardenlinux.constants import ( GL_BUG_REPORT_URL, - GL_COMMIT_SPECIAL_VALUES, GL_DISTRIBUTION_NAME, GL_HOME_URL, GL_RELEASE_ID, GL_SUPPORT_URL, ) -from gardenlinux.features import CName def get_container_amd64_release_metadata(version, commit_hash): diff --git a/tests/flavors/test_main.py b/tests/flavors/test_main.py index 407d746..8c1ecc0 100644 --- a/tests/flavors/test_main.py +++ b/tests/flavors/test_main.py @@ -1,10 +1,7 @@ import json import sys -import pytest - from gardenlinux.flavors import __main__ as fm -from gardenlinux.git import Repository def test_generate_markdown_table(): diff --git a/tests/flavors/test_parser.py b/tests/flavors/test_parser.py index 854318b..e4bfb1b 100644 --- a/tests/flavors/test_parser.py +++ b/tests/flavors/test_parser.py @@ -1,5 +1,3 @@ -import types - import pytest import yaml From 4b8b44b35527f38a0aa7f4588d452827e932bd26 Mon Sep 17 00:00:00 2001 From: Vivus Ignis Date: Fri, 24 Oct 2025 11:07:48 +0200 Subject: [PATCH 11/14] using cname.cname in download_metadata --- .../github/release_notes/helpers.py | 26 ++++++++-------- tests/github/test_download_metadata_files.py | 30 +++++++++++++------ 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/src/gardenlinux/github/release_notes/helpers.py b/src/gardenlinux/github/release_notes/helpers.py index 5111efc..0feb0e5 100644 --- a/src/gardenlinux/github/release_notes/helpers.py +++ b/src/gardenlinux/github/release_notes/helpers.py @@ -61,11 +61,9 @@ def download_all_metadata_files(version, commitish, s3_bucket_name): s3_artifacts = S3Artifacts(s3_bucket_name) - commitish_short = commitish[:8] - for flavor in flavors: - cname = CName(flavor[1], flavor[0], commitish) LOGGER.debug(f"{flavor=} {version=} {commitish=}") + cname = CName(flavor[1], flavor[0], commitish) # Filter by image variants - only download if the flavor matches one of the variants flavor_matches_variant = False for variant_suffix in IMAGE_VARIANTS: @@ -86,8 +84,9 @@ def download_all_metadata_files(version, commitish, s3_bucket_name): continue try: + commit_short = commitish[:8] download_metadata_file( - s3_artifacts, cname.cname, version, commitish_short, local_dest_path + s3_artifacts, cname, version, commit_short, local_dest_path ) except IndexError: LOGGER.warn(f"No artifacts found for flavor {cname.cname}, skipping...") @@ -96,24 +95,23 @@ def download_all_metadata_files(version, commitish, s3_bucket_name): return [str(artifact) for artifact in local_dest_path.iterdir()] -def download_metadata_file( - s3_artifacts, cname, version, commitish_short, artifacts_dir -): +def download_metadata_file(s3_artifacts, cname, version, commit_short, artifacts_dir): """ Download metadata file (s3_metadata.yaml) """ LOGGER.debug( - f"{s3_artifacts=} | {cname=} | {version=} | {commitish_short=} | {artifacts_dir=}" + f"{s3_artifacts=} | {cname.cname=} | {version=} | {cname.commit_id=} | {commit_short=} | {artifacts_dir=}" ) - release_object = list( - s3_artifacts.bucket.objects.filter( - Prefix=f"meta/singles/{cname}-{version}-{commitish_short}" - ) - )[0] + maybe_release_objects = s3_artifacts.bucket.objects.filter( + Prefix=f"meta/singles/{cname.cname}-{version}-{commit_short}" + ) + + release_object = list(maybe_release_objects)[0] LOGGER.debug(f"{release_object.bucket_name=} | {release_object.key=}") s3_artifacts.bucket.download_file( - release_object.key, artifacts_dir.joinpath(f"{cname}.s3_metadata.yaml") + release_object.key, + artifacts_dir.joinpath(f"{cname.cname}.s3_metadata.yaml"), ) diff --git a/tests/github/test_download_metadata_files.py b/tests/github/test_download_metadata_files.py index 3ca5893..98cf62b 100644 --- a/tests/github/test_download_metadata_files.py +++ b/tests/github/test_download_metadata_files.py @@ -7,7 +7,6 @@ from ..constants import ( RELEASE_NOTES_S3_ARTIFACTS_DIR, - TEST_GARDENLINUX_COMMIT, TEST_GARDENLINUX_COMMIT_SHORT, TEST_GARDENLINUX_RELEASE, TEST_GARDENLINUX_RELEASE_BUCKET_NAME, @@ -17,7 +16,7 @@ def test_download_metadata_file(downloads_dir, release_s3_bucket): release_s3_bucket.upload_file( RELEASE_NOTES_S3_ARTIFACTS_DIR / "aws-gardener_prod-amd64.s3_metadata.yaml", - f"meta/singles/test-aws-gardener_prod-amd64-{TEST_GARDENLINUX_RELEASE}-{TEST_GARDENLINUX_COMMIT}", + f"meta/singles/test-aws-gardener_prod-amd64-{TEST_GARDENLINUX_RELEASE}-{TEST_GARDENLINUX_COMMIT_SHORT}", ) s3_artifacts = S3Artifacts(TEST_GARDENLINUX_RELEASE_BUCKET_NAME) @@ -26,7 +25,7 @@ def test_download_metadata_file(downloads_dir, release_s3_bucket): cname = CName("test-aws-gardener_prod", "amd64", TEST_GARDENLINUX_COMMIT_SHORT) download_metadata_file( s3_artifacts, - cname.cname, + cname, TEST_GARDENLINUX_RELEASE, TEST_GARDENLINUX_COMMIT_SHORT, S3_DOWNLOADS_DIR, @@ -37,7 +36,7 @@ def test_download_metadata_file(downloads_dir, release_s3_bucket): def test_download_metadata_file_no_such_release(downloads_dir, release_s3_bucket): release_s3_bucket.upload_file( RELEASE_NOTES_S3_ARTIFACTS_DIR / "aws-gardener_prod-amd64.s3_metadata.yaml", - f"meta/singles/test-aws-gardener_prod-amd64-{TEST_GARDENLINUX_RELEASE}-{TEST_GARDENLINUX_COMMIT}", + f"meta/singles/test-aws-gardener_prod-amd64-{TEST_GARDENLINUX_RELEASE}-{TEST_GARDENLINUX_COMMIT_SHORT}", ) s3_artifacts = S3Artifacts(TEST_GARDENLINUX_RELEASE_BUCKET_NAME) s3_artifacts._bucket = release_s3_bucket @@ -48,7 +47,11 @@ def test_download_metadata_file_no_such_release(downloads_dir, release_s3_bucket with pytest.raises(IndexError): download_metadata_file( - s3_artifacts, cname.cname, release, commit, S3_DOWNLOADS_DIR + s3_artifacts, + cname, + release, + TEST_GARDENLINUX_COMMIT_SHORT, + S3_DOWNLOADS_DIR, ) assert not ( S3_DOWNLOADS_DIR / "test-aws-gardener_prod-amd64.s3_metadata.yaml" @@ -58,7 +61,7 @@ def test_download_metadata_file_no_such_release(downloads_dir, release_s3_bucket def test_download_metadata_file_no_such_commit(downloads_dir, release_s3_bucket): release_s3_bucket.upload_file( RELEASE_NOTES_S3_ARTIFACTS_DIR / "aws-gardener_prod-amd64.s3_metadata.yaml", - f"meta/singles/test-aws-gardener_prod-amd64-{TEST_GARDENLINUX_RELEASE}-{TEST_GARDENLINUX_COMMIT}", + f"meta/singles/test-aws-gardener_prod-amd64-{TEST_GARDENLINUX_RELEASE}-{TEST_GARDENLINUX_COMMIT_SHORT}", ) s3_artifacts = S3Artifacts(TEST_GARDENLINUX_RELEASE_BUCKET_NAME) @@ -70,7 +73,11 @@ def test_download_metadata_file_no_such_commit(downloads_dir, release_s3_bucket) with pytest.raises(IndexError): download_metadata_file( - s3_artifacts, cname.cname, release, commit, S3_DOWNLOADS_DIR + s3_artifacts, + cname, + release, + commit, + S3_DOWNLOADS_DIR, ) assert not ( S3_DOWNLOADS_DIR / "test-aws-gardener_prod-amd64.s3_metadata.yaml" @@ -82,7 +89,7 @@ def test_download_metadata_file_no_such_release_and_commit( ): release_s3_bucket.upload_file( RELEASE_NOTES_S3_ARTIFACTS_DIR / "aws-gardener_prod-amd64.s3_metadata.yaml", - f"meta/singles/test-aws-gardener_prod-amd64-{TEST_GARDENLINUX_RELEASE}-{TEST_GARDENLINUX_COMMIT}", + f"meta/singles/test-aws-gardener_prod-amd64-{TEST_GARDENLINUX_RELEASE}-{TEST_GARDENLINUX_COMMIT_SHORT}", ) s3_artifacts = S3Artifacts(TEST_GARDENLINUX_RELEASE_BUCKET_NAME) @@ -91,10 +98,15 @@ def test_download_metadata_file_no_such_release_and_commit( release = "0000.0" commit = "deadbeef" cname = CName("test-aws-gardener_prod", "amd64", commit) + print(f"{cname.cname=}") with pytest.raises(IndexError): download_metadata_file( - s3_artifacts, cname.cname, release, commit, S3_DOWNLOADS_DIR + s3_artifacts, + cname, + release, + TEST_GARDENLINUX_COMMIT_SHORT, + S3_DOWNLOADS_DIR, ) assert not ( S3_DOWNLOADS_DIR / "test-aws-gardener_prod-amd64.s3_metadata.yaml" From 80e276170b2234b1333ba6eb13381bb1008cac29 Mon Sep 17 00:00:00 2001 From: Vivus Ignis Date: Fri, 24 Oct 2025 11:11:57 +0200 Subject: [PATCH 12/14] reverted release notes test data update to push it in a separate PR --- .../github_release_notes_1877.3.md | 204 +++++++++--------- 1 file changed, 102 insertions(+), 102 deletions(-) diff --git a/test-data/release_notes/github_release_notes_1877.3.md b/test-data/release_notes/github_release_notes_1877.3.md index 83bd76d..ac22830 100644 --- a/test-data/release_notes/github_release_notes_1877.3.md +++ b/test-data/release_notes/github_release_notes_1877.3.md @@ -174,108 +174,108 @@ systemd 257.5-2gl0 ## Changes in Package Versions Compared to 1877.2 | Package | 1877.2 | 1877.3 | |---------|--------------------|-------------------| -|bpftool | `7.5.0+6.12.40-2gl0` | `7.5.0+6.12.44-3gl0` | -|bpftool-dbgsym | `7.5.0+6.12.40-2gl0` | `7.5.0+6.12.44-3gl0` | -|dpkg | `1.22.18` | `1.22.21gl0+bp1877` | -|dpkg-dbgsym | `-` | `1.22.21gl0+bp1877` | -|dpkg-dev | `1.22.18` | `1.22.21gl0+bp1877` | -|dselect | `-` | `1.22.21gl0+bp1877` | -|dselect-dbgsym | `-` | `1.22.21gl0+bp1877` | -|gnutls-bin | `-` | `3.8.9-3gl0+bp1877` | -|gnutls-bin-dbgsym | `-` | `3.8.9-3gl0+bp1877` | -|gnutls-doc | `-` | `3.8.9-3gl0+bp1877` | -|golang-github-opencontainers-runc-dev | `1.1.15+ds1-2gl1+bp1877` | `1.3.0-1gl0+bp1877` | -|hyperv-daemons | `6.12.40-2gl0` | `6.12.44-3gl0` | -|hyperv-daemons-dbgsym | `6.12.40-2gl0` | `6.12.44-3gl0` | -|intel-sdsi | `6.12.40-2gl0` | `6.12.44-3gl0` | -|intel-sdsi-dbgsym | `6.12.40-2gl0` | `6.12.44-3gl0` | -|iputils-arping | `3:20240905-3` | `3:20250605-1gl0~bp1877` | -|iputils-arping-dbgsym | `-` | `3:20250605-1gl0~bp1877` | -|iputils-clockdiff | `-` | `3:20250605-1gl0~bp1877` | -|iputils-clockdiff-dbgsym | `-` | `3:20250605-1gl0~bp1877` | -|iputils-ping | `3:20240905-3` | `3:20250605-1gl0~bp1877` | -|iputils-ping-dbgsym | `-` | `3:20250605-1gl0~bp1877` | -|iputils-tracepath | `3:20240905-3` | `3:20250605-1gl0~bp1877` | -|iputils-tracepath-dbgsym | `-` | `3:20250605-1gl0~bp1877` | -|lemon | `-` | `3.46.1-7gl0+bp1877` | -|lemon-dbgsym | `-` | `3.46.1-7gl0+bp1877` | -|libcpupower-dev | `6.12.40-2gl0` | `6.12.44-3gl0` | -|libcpupower1 | `6.12.40-2gl0` | `6.12.44-3gl0` | -|libcpupower1-dbgsym | `6.12.40-2gl0` | `6.12.44-3gl0` | -|libdpkg-dev | `-` | `1.22.21gl0+bp1877` | -|libdpkg-perl | `1.22.18` | `1.22.21gl0+bp1877` | -|libgnutls-dane0t64 | `3.8.9-2` | `3.8.9-3gl0+bp1877` | -|libgnutls-dane0t64-dbgsym | `-` | `3.8.9-3gl0+bp1877` | -|libgnutls-openssl27t64 | `3.8.9-2` | `3.8.9-3gl0+bp1877` | -|libgnutls-openssl27t64-dbgsym | `-` | `3.8.9-3gl0+bp1877` | -|libgnutls28-dev | `3.8.9-2` | `3.8.9-3gl0+bp1877` | -|libgnutls30t64 | `3.8.9-2` | `3.8.9-3gl0+bp1877` | -|libgnutls30t64-dbgsym | `-` | `3.8.9-3gl0+bp1877` | -|libmd-dev | `-` | `1.1.0-2+b1` | -|libsqlite3-0 | `3.46.1-4` | `3.46.1-7gl0+bp1877` | -|libsqlite3-0-dbgsym | `-` | `3.46.1-7gl0+bp1877` | -|libsqlite3-dev | `-` | `3.46.1-7gl0+bp1877` | -|libsqlite3-ext-csv | `-` | `3.46.1-7gl0+bp1877` | -|libsqlite3-ext-csv-dbgsym | `-` | `3.46.1-7gl0+bp1877` | -|libsqlite3-ext-icu | `-` | `3.46.1-7gl0+bp1877` | -|libsqlite3-ext-icu-dbgsym | `-` | `3.46.1-7gl0+bp1877` | -|libsqlite3-tcl | `-` | `3.46.1-7gl0+bp1877` | -|libsqlite3-tcl-dbgsym | `-` | `3.46.1-7gl0+bp1877` | -|linux-base | `4.11` | `4.12gl0+bp1877` | -|linux-bpf-dev | `6.12.40-2gl0` | `6.12.44-3gl0` | -|linux-config-6.12 | `6.12.40-2gl0` | `6.12.44-3gl0` | -|linux-cpupower | `6.12.40-2gl0` | `6.12.44-3gl0` | -|linux-cpupower-dbgsym | `6.12.40-2gl0` | `6.12.44-3gl0` | -|linux-headers-6.12.40-amd64 | `6.12.40-2gl0` | `-` | -|linux-headers-6.12.40-cloud-amd64 | `6.12.40-2gl0` | `-` | -|linux-headers-6.12.40-common | `6.12.40-2gl0` | `-` | -|linux-headers-6.12.40-firecracker-amd64 | `6.12.40-2gl0` | `-` | -|linux-headers-6.12.44-amd64 | `-` | `6.12.44-3gl0` | -|linux-headers-6.12.44-cloud-amd64 | `-` | `6.12.44-3gl0` | -|linux-headers-6.12.44-common | `-` | `6.12.44-3gl0` | -|linux-headers-6.12.44-firecracker-amd64 | `-` | `6.12.44-3gl0` | -|linux-headers-amd64 | `6.12.40-2gl0` | `6.12.44-3gl0` | -|linux-headers-cloud-amd64 | `6.12.40-2gl0` | `6.12.44-3gl0` | -|linux-headers-firecracker-amd64 | `6.12.40-2gl0` | `6.12.44-3gl0` | -|linux-image-6.12.40-amd64 | `6.12.40-2gl0` | `-` | -|linux-image-6.12.40-amd64-dbg | `6.12.40-2gl0` | `-` | -|linux-image-6.12.40-cloud-amd64 | `6.12.40-2gl0` | `-` | -|linux-image-6.12.40-cloud-amd64-dbg | `6.12.40-2gl0` | `-` | -|linux-image-6.12.40-firecracker-amd64 | `6.12.40-2gl0` | `-` | -|linux-image-6.12.40-firecracker-amd64-dbg | `6.12.40-2gl0` | `-` | -|linux-image-6.12.44-amd64 | `-` | `6.12.44-3gl0` | -|linux-image-6.12.44-amd64-dbg | `-` | `6.12.44-3gl0` | -|linux-image-6.12.44-cloud-amd64 | `-` | `6.12.44-3gl0` | -|linux-image-6.12.44-cloud-amd64-dbg | `-` | `6.12.44-3gl0` | -|linux-image-6.12.44-firecracker-amd64 | `-` | `6.12.44-3gl0` | -|linux-image-6.12.44-firecracker-amd64-dbg | `-` | `6.12.44-3gl0` | -|linux-image-amd64 | `6.12.40-2gl0` | `6.12.44-3gl0` | -|linux-image-amd64-dbg | `6.12.40-2gl0` | `6.12.44-3gl0` | -|linux-image-cloud-amd64 | `6.12.40-2gl0` | `6.12.44-3gl0` | -|linux-image-cloud-amd64-dbg | `6.12.40-2gl0` | `6.12.44-3gl0` | -|linux-image-firecracker-amd64 | `6.12.40-2gl0` | `6.12.44-3gl0` | -|linux-image-firecracker-amd64-dbg | `6.12.40-2gl0` | `6.12.44-3gl0` | -|linux-kbuild-6.12.40 | `6.12.40-2gl0` | `-` | -|linux-kbuild-6.12.40-dbgsym | `6.12.40-2gl0` | `-` | -|linux-kbuild-6.12.44 | `-` | `6.12.44-3gl0` | -|linux-kbuild-6.12.44-dbgsym | `-` | `6.12.44-3gl0` | -|linux-libc-dev | `6.12.40-2gl0` | `6.12.44-3gl0` | -|linux-source | `6.12.40-2gl0` | `6.12.44-3gl0` | -|linux-source-6.12 | `6.12.40-2gl0` | `6.12.44-3gl0` | -|linux-support-6.12.40 | `6.12.40-2gl0` | `-` | -|linux-support-6.12.44 | `-` | `6.12.44-3gl0` | -|linux-sysctl-defaults | `4.11` | `4.12gl0+bp1877` | -|rtla | `6.12.40-2gl0` | `6.12.44-3gl0` | -|rtla-dbgsym | `6.12.40-2gl0` | `6.12.44-3gl0` | -|runc | `1.1.15+ds1-2gl1+bp1877` | `1.3.0-1gl0+bp1877` | -|runc-dbgsym | `1.1.15+ds1-2gl1+bp1877` | `1.3.0-1gl0+bp1877` | -|sqlite3 | `-` | `3.46.1-7gl0+bp1877` | -|sqlite3-dbgsym | `-` | `3.46.1-7gl0+bp1877` | -|sqlite3-doc | `-` | `3.46.1-7gl0+bp1877` | -|sqlite3-tools | `-` | `3.46.1-7gl0+bp1877` | -|sqlite3-tools-dbgsym | `-` | `3.46.1-7gl0+bp1877` | -|usbip | `2.0+6.12.40-2gl0` | `2.0+6.12.44-3gl0` | -|usbip-dbgsym | `2.0+6.12.40-2gl0` | `2.0+6.12.44-3gl0` | +|bpftool | 7.5.0+6.12.40-2gl0 | 7.5.0+6.12.44-3gl0 | +|bpftool-dbgsym | 7.5.0+6.12.40-2gl0 | 7.5.0+6.12.44-3gl0 | +|dpkg | 1.22.18 | 1.22.21gl0+bp1877 | +|dpkg-dbgsym | - | 1.22.21gl0+bp1877 | +|dpkg-dev | 1.22.18 | 1.22.21gl0+bp1877 | +|dselect | - | 1.22.21gl0+bp1877 | +|dselect-dbgsym | - | 1.22.21gl0+bp1877 | +|gnutls-bin | - | 3.8.9-3gl0+bp1877 | +|gnutls-bin-dbgsym | - | 3.8.9-3gl0+bp1877 | +|gnutls-doc | - | 3.8.9-3gl0+bp1877 | +|golang-github-opencontainers-runc-dev | 1.1.15+ds1-2gl1+bp1877 | 1.3.0-1gl0+bp1877 | +|hyperv-daemons | 6.12.40-2gl0 | 6.12.44-3gl0 | +|hyperv-daemons-dbgsym | 6.12.40-2gl0 | 6.12.44-3gl0 | +|intel-sdsi | 6.12.40-2gl0 | 6.12.44-3gl0 | +|intel-sdsi-dbgsym | 6.12.40-2gl0 | 6.12.44-3gl0 | +|iputils-arping | 3:20240905-3 | 3:20250605-1gl0~bp1877 | +|iputils-arping-dbgsym | - | 3:20250605-1gl0~bp1877 | +|iputils-clockdiff | - | 3:20250605-1gl0~bp1877 | +|iputils-clockdiff-dbgsym | - | 3:20250605-1gl0~bp1877 | +|iputils-ping | 3:20240905-3 | 3:20250605-1gl0~bp1877 | +|iputils-ping-dbgsym | - | 3:20250605-1gl0~bp1877 | +|iputils-tracepath | 3:20240905-3 | 3:20250605-1gl0~bp1877 | +|iputils-tracepath-dbgsym | - | 3:20250605-1gl0~bp1877 | +|lemon | - | 3.46.1-7gl0+bp1877 | +|lemon-dbgsym | - | 3.46.1-7gl0+bp1877 | +|libcpupower-dev | 6.12.40-2gl0 | 6.12.44-3gl0 | +|libcpupower1 | 6.12.40-2gl0 | 6.12.44-3gl0 | +|libcpupower1-dbgsym | 6.12.40-2gl0 | 6.12.44-3gl0 | +|libdpkg-dev | - | 1.22.21gl0+bp1877 | +|libdpkg-perl | 1.22.18 | 1.22.21gl0+bp1877 | +|libgnutls-dane0t64 | 3.8.9-2 | 3.8.9-3gl0+bp1877 | +|libgnutls-dane0t64-dbgsym | - | 3.8.9-3gl0+bp1877 | +|libgnutls-openssl27t64 | 3.8.9-2 | 3.8.9-3gl0+bp1877 | +|libgnutls-openssl27t64-dbgsym | - | 3.8.9-3gl0+bp1877 | +|libgnutls28-dev | 3.8.9-2 | 3.8.9-3gl0+bp1877 | +|libgnutls30t64 | 3.8.9-2 | 3.8.9-3gl0+bp1877 | +|libgnutls30t64-dbgsym | - | 3.8.9-3gl0+bp1877 | +|libmd-dev | - | 1.1.0-2+b1 | +|libsqlite3-0 | 3.46.1-4 | 3.46.1-7gl0+bp1877 | +|libsqlite3-0-dbgsym | - | 3.46.1-7gl0+bp1877 | +|libsqlite3-dev | - | 3.46.1-7gl0+bp1877 | +|libsqlite3-ext-csv | - | 3.46.1-7gl0+bp1877 | +|libsqlite3-ext-csv-dbgsym | - | 3.46.1-7gl0+bp1877 | +|libsqlite3-ext-icu | - | 3.46.1-7gl0+bp1877 | +|libsqlite3-ext-icu-dbgsym | - | 3.46.1-7gl0+bp1877 | +|libsqlite3-tcl | - | 3.46.1-7gl0+bp1877 | +|libsqlite3-tcl-dbgsym | - | 3.46.1-7gl0+bp1877 | +|linux-base | 4.11 | 4.12gl0+bp1877 | +|linux-bpf-dev | 6.12.40-2gl0 | 6.12.44-3gl0 | +|linux-config-6.12 | 6.12.40-2gl0 | 6.12.44-3gl0 | +|linux-cpupower | 6.12.40-2gl0 | 6.12.44-3gl0 | +|linux-cpupower-dbgsym | 6.12.40-2gl0 | 6.12.44-3gl0 | +|linux-headers-6.12.40-amd64 | 6.12.40-2gl0 | - | +|linux-headers-6.12.40-cloud-amd64 | 6.12.40-2gl0 | - | +|linux-headers-6.12.40-common | 6.12.40-2gl0 | - | +|linux-headers-6.12.40-firecracker-amd64 | 6.12.40-2gl0 | - | +|linux-headers-6.12.44-amd64 | - | 6.12.44-3gl0 | +|linux-headers-6.12.44-cloud-amd64 | - | 6.12.44-3gl0 | +|linux-headers-6.12.44-common | - | 6.12.44-3gl0 | +|linux-headers-6.12.44-firecracker-amd64 | - | 6.12.44-3gl0 | +|linux-headers-amd64 | 6.12.40-2gl0 | 6.12.44-3gl0 | +|linux-headers-cloud-amd64 | 6.12.40-2gl0 | 6.12.44-3gl0 | +|linux-headers-firecracker-amd64 | 6.12.40-2gl0 | 6.12.44-3gl0 | +|linux-image-6.12.40-amd64 | 6.12.40-2gl0 | - | +|linux-image-6.12.40-amd64-dbg | 6.12.40-2gl0 | - | +|linux-image-6.12.40-cloud-amd64 | 6.12.40-2gl0 | - | +|linux-image-6.12.40-cloud-amd64-dbg | 6.12.40-2gl0 | - | +|linux-image-6.12.40-firecracker-amd64 | 6.12.40-2gl0 | - | +|linux-image-6.12.40-firecracker-amd64-dbg | 6.12.40-2gl0 | - | +|linux-image-6.12.44-amd64 | - | 6.12.44-3gl0 | +|linux-image-6.12.44-amd64-dbg | - | 6.12.44-3gl0 | +|linux-image-6.12.44-cloud-amd64 | - | 6.12.44-3gl0 | +|linux-image-6.12.44-cloud-amd64-dbg | - | 6.12.44-3gl0 | +|linux-image-6.12.44-firecracker-amd64 | - | 6.12.44-3gl0 | +|linux-image-6.12.44-firecracker-amd64-dbg | - | 6.12.44-3gl0 | +|linux-image-amd64 | 6.12.40-2gl0 | 6.12.44-3gl0 | +|linux-image-amd64-dbg | 6.12.40-2gl0 | 6.12.44-3gl0 | +|linux-image-cloud-amd64 | 6.12.40-2gl0 | 6.12.44-3gl0 | +|linux-image-cloud-amd64-dbg | 6.12.40-2gl0 | 6.12.44-3gl0 | +|linux-image-firecracker-amd64 | 6.12.40-2gl0 | 6.12.44-3gl0 | +|linux-image-firecracker-amd64-dbg | 6.12.40-2gl0 | 6.12.44-3gl0 | +|linux-kbuild-6.12.40 | 6.12.40-2gl0 | - | +|linux-kbuild-6.12.40-dbgsym | 6.12.40-2gl0 | - | +|linux-kbuild-6.12.44 | - | 6.12.44-3gl0 | +|linux-kbuild-6.12.44-dbgsym | - | 6.12.44-3gl0 | +|linux-libc-dev | 6.12.40-2gl0 | 6.12.44-3gl0 | +|linux-source | 6.12.40-2gl0 | 6.12.44-3gl0 | +|linux-source-6.12 | 6.12.40-2gl0 | 6.12.44-3gl0 | +|linux-support-6.12.40 | 6.12.40-2gl0 | - | +|linux-support-6.12.44 | - | 6.12.44-3gl0 | +|linux-sysctl-defaults | 4.11 | 4.12gl0+bp1877 | +|rtla | 6.12.40-2gl0 | 6.12.44-3gl0 | +|rtla-dbgsym | 6.12.40-2gl0 | 6.12.44-3gl0 | +|runc | 1.1.15+ds1-2gl1+bp1877 | 1.3.0-1gl0+bp1877 | +|runc-dbgsym | 1.1.15+ds1-2gl1+bp1877 | 1.3.0-1gl0+bp1877 | +|sqlite3 | - | 3.46.1-7gl0+bp1877 | +|sqlite3-dbgsym | - | 3.46.1-7gl0+bp1877 | +|sqlite3-doc | - | 3.46.1-7gl0+bp1877 | +|sqlite3-tools | - | 3.46.1-7gl0+bp1877 | +|sqlite3-tools-dbgsym | - | 3.46.1-7gl0+bp1877 | +|usbip | 2.0+6.12.40-2gl0 | 2.0+6.12.44-3gl0 | +|usbip-dbgsym | 2.0+6.12.40-2gl0 | 2.0+6.12.44-3gl0 | ## Published Images
From a1a814b71125176801704019cab3aac695716267 Mon Sep 17 00:00:00 2001 From: Vivus Ignis Date: Fri, 24 Oct 2025 12:26:54 +0200 Subject: [PATCH 13/14] disabled meaningless pyright checks --- tests/github/conftest.py | 6 ++++-- tests/github/test_create_github_release_notes.py | 13 ++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/github/conftest.py b/tests/github/conftest.py index a9e694c..d15d4f3 100644 --- a/tests/github/conftest.py +++ b/tests/github/conftest.py @@ -44,11 +44,13 @@ def release_id_file(): def release_s3_bucket(): with mock_aws(): s3 = boto3.resource("s3", region_name="eu-central-1") - s3.create_bucket( + s3.create_bucket( # pyright: ignore[reportAttributeAccessIssue] Bucket=TEST_GARDENLINUX_RELEASE_BUCKET_NAME, CreateBucketConfiguration={"LocationConstraint": "eu-central-1"}, ) - yield s3.Bucket(TEST_GARDENLINUX_RELEASE_BUCKET_NAME) + yield s3.Bucket( # pyright: ignore[reportAttributeAccessIssue] + TEST_GARDENLINUX_RELEASE_BUCKET_NAME + ) @pytest.fixture diff --git a/tests/github/test_create_github_release_notes.py b/tests/github/test_create_github_release_notes.py index 0efaae4..f984b34 100644 --- a/tests/github/test_create_github_release_notes.py +++ b/tests/github/test_create_github_release_notes.py @@ -144,7 +144,8 @@ def __new__(cls, *args, **kwargs): return sr monkeypatch.setattr( - "gardenlinux.github.release_notes.helpers.Repo", SubmoduleAsRepo + "gardenlinux.github.release_notes.helpers.Repo", # pyright: ignore[reportAttributeAccessIssue] + SubmoduleAsRepo, ) import gardenlinux.github @@ -168,12 +169,10 @@ def __new__(cls, *args, **kwargs): text=glvd_response_fixture_path.read_text(), status_code=200, ) - generated_release_notes = ( - gardenlinux.github.release_notes.create_github_release_notes( - TEST_GARDENLINUX_RELEASE, - TEST_GARDENLINUX_COMMIT, - release_s3_bucket.name, - ) + generated_release_notes = gardenlinux.github.release_notes.create_github_release_notes( # pyright: ignore[reportAttributeAccessIssue] + TEST_GARDENLINUX_RELEASE, + TEST_GARDENLINUX_COMMIT, + release_s3_bucket.name, ) assert generated_release_notes == release_fixture_path.read_text() From 00c8cce6acbcb6b9ff5bae1a582b9c14e4c920af Mon Sep 17 00:00:00 2001 From: Vivus Ignis Date: Fri, 24 Oct 2025 12:34:46 +0200 Subject: [PATCH 14/14] one more pyright ignore --- tests/github/test_create_github_release_notes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/github/test_create_github_release_notes.py b/tests/github/test_create_github_release_notes.py index f984b34..38fc56b 100644 --- a/tests/github/test_create_github_release_notes.py +++ b/tests/github/test_create_github_release_notes.py @@ -126,7 +126,7 @@ class SubmoduleAsRepo(Repo): """This will fake a git submodule as a git repository object.""" def __new__(cls, *args, **kwargs): - r = super().__new__(Repo) + r = super().__new__(Repo) # pyright: ignore[reportArgumentType] r.__init__(*args, **kwargs) maybe_gl_submodule = [