From 1900f28a4c1be9b5c91658d7db72d8d208a21044 Mon Sep 17 00:00:00 2001 From: Tobias Wolf Date: Thu, 2 Oct 2025 09:48:02 +0200 Subject: [PATCH] Add `gl-gh-release` script to our list of available tools Signed-off-by: Tobias Wolf --- pyproject.toml | 1 + src/gardenlinux/constants.py | 2 +- src/gardenlinux/github/__init__.py | 0 src/gardenlinux/github/{ => release}/__main__.py | 4 ++-- tests/github/test_github_script.py | 10 +++++----- tests/github/test_upload_to_github_release_page.py | 4 ++-- 6 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 src/gardenlinux/github/__init__.py rename src/gardenlinux/github/{ => release}/__main__.py (96%) diff --git a/pyproject.toml b/pyproject.toml index d05accef..fe26e327 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,7 @@ sphinx-rtd-theme = "^3.0.2" gl-cname = "gardenlinux.features.cname_main:main" gl-features-parse = "gardenlinux.features.__main__:main" gl-flavors-parse = "gardenlinux.flavors.__main__:main" +gl-gh-release = "gardenlinux.github.release.__main__:main" gl-oci = "gardenlinux.oci.__main__:main" gl-s3 = "gardenlinux.s3.__main__:main" gl-gh = "gardenlinux.github.__main__:main" diff --git a/src/gardenlinux/constants.py b/src/gardenlinux/constants.py index bb8bbc67..b0c1ffbf 100644 --- a/src/gardenlinux/constants.py +++ b/src/gardenlinux/constants.py @@ -161,10 +161,10 @@ S3_DOWNLOADS_DIR = Path(os.path.dirname(__file__)) / ".." / "s3_downloads" +GL_DEB_REPO_BASE_URL = "https://packages.gardenlinux.io/gardenlinux" GLVD_BASE_URL = ( "https://glvd.ingress.glvd.gardnlinux.shoot.canary.k8s-hana.ondemand.com/v1" ) -GL_DEB_REPO_BASE_URL = "https://packages.gardenlinux.io/gardenlinux" GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME = "gardenlinux-github-releases" diff --git a/src/gardenlinux/github/__init__.py b/src/gardenlinux/github/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/gardenlinux/github/__main__.py b/src/gardenlinux/github/release/__main__.py similarity index 96% rename from src/gardenlinux/github/__main__.py rename to src/gardenlinux/github/release/__main__.py index d3b33a21..498d4c99 100644 --- a/src/gardenlinux/github/__main__.py +++ b/src/gardenlinux/github/release/__main__.py @@ -3,12 +3,12 @@ from gardenlinux.constants import GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME from gardenlinux.logger import LoggerSetup -from .release import ( +from . import ( create_github_release, upload_to_github_release_page, write_to_release_id_file, ) -from .release_notes import create_github_release_notes +from ..release_notes import create_github_release_notes LOGGER = LoggerSetup.get_logger("gardenlinux.github", "INFO") diff --git a/tests/github/test_github_script.py b/tests/github/test_github_script.py index 14c55698..9b0acc43 100644 --- a/tests/github/test_github_script.py +++ b/tests/github/test_github_script.py @@ -2,7 +2,7 @@ import pytest -import gardenlinux.github.__main__ as gh +import gardenlinux.github.release.__main__ as gh from gardenlinux.constants import GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME from ..constants import TEST_GARDENLINUX_COMMIT, TEST_GARDENLINUX_RELEASE @@ -69,7 +69,7 @@ def test_script_create_dry_run(monkeypatch, capfd): ], ) monkeypatch.setattr( - "gardenlinux.github.__main__.create_github_release_notes", + "gardenlinux.github.release.__main__.create_github_release_notes", lambda tag, commit, bucket: f"{tag} {commit} {bucket}", ) @@ -100,11 +100,11 @@ def test_script_create(monkeypatch, caplog): ], ) monkeypatch.setattr( - "gardenlinux.github.__main__.create_github_release_notes", + "gardenlinux.github.release.__main__.create_github_release_notes", lambda tag, commit, bucket: f"{tag} {commit} {bucket}", ) monkeypatch.setattr( - "gardenlinux.github.__main__.create_github_release", + "gardenlinux.github.release.__main__.create_github_release", lambda a1, a2, a3, a4, a5, a6: TEST_GARDENLINUX_RELEASE, ) @@ -135,7 +135,7 @@ def test_script_upload_dry_run(monkeypatch, capfd): ], ) monkeypatch.setattr( - "gardenlinux.github.__main__.upload_to_github_release_page", + "gardenlinux.github.release.__main__.upload_to_github_release_page", lambda a1, a2, a3, a4, dry_run: print(f"dry-run: {dry_run}"), ) diff --git a/tests/github/test_upload_to_github_release_page.py b/tests/github/test_upload_to_github_release_page.py index 09596c7f..04ce3cb6 100644 --- a/tests/github/test_upload_to_github_release_page.py +++ b/tests/github/test_upload_to_github_release_page.py @@ -4,7 +4,7 @@ import requests import requests_mock -import gardenlinux.github.__main__ as gh +import gardenlinux.github.release.__main__ as gh from gardenlinux.github.release import upload_to_github_release_page from ..constants import TEST_GARDENLINUX_RELEASE @@ -153,7 +153,7 @@ def test_script_upload_dry_run(monkeypatch, capfd): ], ) monkeypatch.setattr( - "gardenlinux.github.__main__.upload_to_github_release_page", + "gardenlinux.github.release.__main__.upload_to_github_release_page", lambda a1, a2, a3, a4, dry_run: print(f"dry-run: {dry_run}"), )