Skip to content

Commit bce31e2

Browse files
committed
Add gl-gh-release script to our list of available tools
Signed-off-by: Tobias Wolf <wolf@b1-systems.de>
1 parent 2c7c395 commit bce31e2

File tree

6 files changed

+16
-11
lines changed

6 files changed

+16
-11
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ sphinx-rtd-theme = "^3.0.2"
3939
gl-cname = "gardenlinux.features.cname_main:main"
4040
gl-features-parse = "gardenlinux.features.__main__:main"
4141
gl-flavors-parse = "gardenlinux.flavors.__main__:main"
42+
gl-gh-release = "gardenlinux.github.release.__main__:main"
4243
gl-oci = "gardenlinux.oci.__main__:main"
4344
gl-s3 = "gardenlinux.s3.__main__:main"
4445

src/gardenlinux/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@
159159

160160
S3_DOWNLOADS_DIR = Path(os.path.dirname(__file__)) / ".." / "s3_downloads"
161161

162+
GL_DEB_REPO_BASE_URL = "https://packages.gardenlinux.io/gardenlinux"
162163
GLVD_BASE_URL = (
163164
"https://glvd.ingress.glvd.gardnlinux.shoot.canary.k8s-hana.ondemand.com/v1"
164165
)
165-
GL_DEB_REPO_BASE_URL = "https://packages.gardenlinux.io/gardenlinux"
166166

167167
GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME = "gardenlinux-github-releases"
168168

src/gardenlinux/github/__init__.py

Whitespace-only changes.

src/gardenlinux/github/__main__.py renamed to src/gardenlinux/github/release/__main__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
from gardenlinux.constants import GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME
44
from gardenlinux.logger import LoggerSetup
55

6-
from .release import create_github_release, upload_to_github_release_page, write_to_release_id_file
7-
from .release_notes import create_github_release_notes
6+
from . import (
7+
create_github_release,
8+
upload_to_github_release_page,
9+
write_to_release_id_file,
10+
)
11+
from ..release_notes import create_github_release_notes
812

913
LOGGER = LoggerSetup.get_logger("gardenlinux.github", "INFO")
1014

@@ -18,7 +22,7 @@ def main():
1822
create_parser.add_argument("--repo", default="gardenlinux")
1923
create_parser.add_argument("--tag", required=True)
2024
create_parser.add_argument("--commit", required=True)
21-
create_parser.add_argument('--latest', action='store_true', default=False)
25+
create_parser.add_argument("--latest", action="store_true", default=False)
2226
create_parser.add_argument("--dry-run", action="store_true", default=False)
2327

2428
upload_parser = subparsers.add_parser("upload")

tests/github/test_github_script.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44

5-
import gardenlinux.github.__main__ as gh
5+
import gardenlinux.github.release.__main__ as gh
66
from gardenlinux.constants import GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME
77

88
from ..constants import TEST_GARDENLINUX_COMMIT, TEST_GARDENLINUX_RELEASE
@@ -44,7 +44,7 @@ def test_script_create_dry_run(monkeypatch, capfd):
4444

4545
monkeypatch.setattr(sys, "argv", ["gh", "create", "--owner", "gardenlinux", "--repo",
4646
"gardenlinux", "--tag", TEST_GARDENLINUX_RELEASE, "--commit", TEST_GARDENLINUX_COMMIT, "--dry-run"])
47-
monkeypatch.setattr("gardenlinux.github.__main__.create_github_release_notes",
47+
monkeypatch.setattr("gardenlinux.github.release.__main__.create_github_release_notes",
4848
lambda tag, commit, bucket: f"{tag} {commit} {bucket}")
4949

5050
gh.main()
@@ -57,9 +57,9 @@ def test_script_create_dry_run(monkeypatch, capfd):
5757
def test_script_create(monkeypatch, caplog):
5858
monkeypatch.setattr(sys, "argv", ["gh", "create", "--owner", "gardenlinux", "--repo",
5959
"gardenlinux", "--tag", TEST_GARDENLINUX_RELEASE, "--commit", TEST_GARDENLINUX_COMMIT])
60-
monkeypatch.setattr("gardenlinux.github.__main__.create_github_release_notes",
60+
monkeypatch.setattr("gardenlinux.github.release.__main__.create_github_release_notes",
6161
lambda tag, commit, bucket: f"{tag} {commit} {bucket}")
62-
monkeypatch.setattr("gardenlinux.github.__main__.create_github_release",
62+
monkeypatch.setattr("gardenlinux.github.release.__main__.create_github_release",
6363
lambda a1, a2, a3, a4, a5, a6: TEST_GARDENLINUX_RELEASE)
6464

6565
gh.main()
@@ -71,7 +71,7 @@ def test_script_create(monkeypatch, caplog):
7171
def test_script_upload_dry_run(monkeypatch, capfd):
7272
monkeypatch.setattr(sys, "argv", ["gh", "upload", "--owner", "gardenlinux", "--repo",
7373
"gardenlinux", "--release_id", TEST_GARDENLINUX_RELEASE, "--file_path", "foo", "--dry-run"])
74-
monkeypatch.setattr("gardenlinux.github.__main__.upload_to_github_release_page",
74+
monkeypatch.setattr("gardenlinux.github.release.__main__.upload_to_github_release_page",
7575
lambda a1, a2, a3, a4, dry_run: print(f"dry-run: {dry_run}"))
7676

7777
gh.main()

tests/github/test_upload_to_github_release_page.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import requests
55
import requests_mock
66

7-
import gardenlinux.github.__main__ as gh
7+
import gardenlinux.github.release.__main__ as gh
88
from gardenlinux.github.release import upload_to_github_release_page
99

1010
from ..constants import TEST_GARDENLINUX_RELEASE
@@ -108,7 +108,7 @@ def test_script_parse_args_upload_command_required_args(monkeypatch, capfd):
108108
def test_script_upload_dry_run(monkeypatch, capfd):
109109
monkeypatch.setattr(sys, "argv", ["gh", "upload", "--owner", "gardenlinux", "--repo",
110110
"gardenlinux", "--release_id", TEST_GARDENLINUX_RELEASE, "--file_path", "foo", "--dry-run"])
111-
monkeypatch.setattr("gardenlinux.github.__main__.upload_to_github_release_page",
111+
monkeypatch.setattr("gardenlinux.github.release.__main__.upload_to_github_release_page",
112112
lambda a1, a2, a3, a4, dry_run: print(f"dry-run: {dry_run}"))
113113

114114
gh.main()

0 commit comments

Comments
 (0)