ClickHouse/tests/ci/download_release_packages.py
2024-06-06 07:24:58 +02:00

39 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python3
import logging
from pathlib import Path
from build_download_helper import DownloadException, download_build_with_progress
from get_previous_release_tag import (
ReleaseInfo,
get_previous_release,
get_release_by_tag,
)
PACKAGES_DIR = Path("previous_release_package_folder")
def download_packages(release: ReleaseInfo, dest_path: Path = PACKAGES_DIR) -> None:
dest_path.mkdir(parents=True, exist_ok=True)
logging.info("Will download %s", release)
for pkg, url in release.assets.items():
if not pkg.endswith("_amd64.deb") or "-dbg_" in pkg:
continue
pkg_name = dest_path / pkg
download_build_with_progress(url, pkg_name)
def download_last_release(dest_path: Path) -> None:
current_release = get_previous_release(None)
if current_release is None:
raise DownloadException("The current release is not found")
download_packages(current_release, dest_path=dest_path)
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
release = get_release_by_tag(input())
download_packages(release)